. . . try: raise MiExcepcion('algopasa ha pasado') except MiExcepcion as me: print("Ha ocurrido un error", e.valor) . . .