Did I find the right examples for you? yes no

All Samples(2)  |  Call(0)  |  Derive(0)  |  Import(2)
I return a function decorator wrapping all exceptions as `extype`.
    

        def wrap_exceptions(extype):
    """I return a function decorator wrapping all exceptions as `extype`.
    """
    assert issubclass(extype, BaseException), \
        "Did you write @wrap_exception instead of @wrap_exception(extype)?"
    def wrap_exceptions_decorator(func):
        """The decorator returned by wrap_exceptions"""
        @wraps(func)
        def wrapped(*args, **kw):
            """The decorated function"""
            try:
                return func(*args, **kw)
            except BaseException, ex:
                raise extype(ex)
        return wrapped
    return wrap_exceptions_decorator
        


src/k/t/kTBS-0.2/lib/rdfrest/parsers.py   kTBS(Download)
 
from .exceptions import ParseError
from .utils import coerce_to_uri, wrap_exceptions
 
################################################################

src/k/t/ktbs-HEAD/lib/rdfrest/parsers.py   ktbs(Download)
 
from .exceptions import ParseError
from .utils import coerce_to_uri, wrap_exceptions
 
################################################################