def peel_handler_exception(meth): try: return meth() except HandlerException, he: cause = he.cause t = getattr(cause, "type", cause.__class__) info = sys.exc_info() _compat.raise_(t, cause, info[2])
def put(self, putter, v): """More informative exception from putters, include bad value""" try: putter(v) except Exception: etype, value, trace = sys.exc_info() raise_(etype, etype("%s(%r): %s" % (putter.__name__, v, value)), trace) return putter
def peel_handler_exception(meth): try: return meth() except HandlerException, he: cause = he.cause if hasattr(cause, "value"): cause = cause.value t = type(cause) info = sys.exc_info() _compat.raise_(t, cause, info[2])