INNER CODE UNIT · Python

override

mongodb/mongo-c-driver · lldb_bson.py:94

    def override(f: T) -> T:
        return f


def print_errors(fn: FuncT) -> FuncT:
    """Exceptions from the decorated function will be printed, then re-raised"""

    @functools.wraps(fn)
    def _wrap(*args: Any, **kwargs: Any) -> Any:
        try:
            return fn(*args, **kwargs)
        except:
            e = traceback.format_exc()
            print(e)
            raise

    return cast('FuncT', _wrap)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…