MCPcopy Index your code
hub / github.com/pre-commit/pre-commit / error_handler

Function error_handler

pre_commit/error_handler.py:71–81  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69
70@contextlib.contextmanager
71def error_handler() -> Generator[None]:
72 try:
73 yield
74 except (Exception, KeyboardInterrupt) as e:
75 if isinstance(e, FatalError):
76 msg, ret_code = 'An error has occurred', 1
77 elif isinstance(e, KeyboardInterrupt):
78 msg, ret_code = 'Interrupted (^C)', 130
79 else:
80 msg, ret_code = 'An unexpected error has occurred', 3
81 _log_and_exit(msg, ret_code, e, traceback.format_exc())

Callers 1

mainFunction · 0.90

Calls 1

_log_and_exitFunction · 0.85

Tested by

no test coverage detected