MCPcopy Index your code
hub / github.com/RustPython/RustPython / call_exception_handler

Method call_exception_handler

Lib/asyncio/base_events.py:1877–1949  ·  view source on GitHub ↗

Call the current event loop's exception handler. The context argument is a dict containing the following keys: - 'message': Error message; - 'exception' (optional): Exception object; - 'future' (optional): Future instance; - 'task' (optional): Task instance;

(self, context)

Source from the content-addressed store, hash-verified

1875 logger.error('\n'.join(log_lines), exc_info=exc_info)
1876
1877 def call_exception_handler(self, context):
1878 """Call the current event loop's exception handler.
1879
1880 The context argument is a dict containing the following keys:
1881
1882 - 'message': Error message;
1883 - 'exception' (optional): Exception object;
1884 - 'future' (optional): Future instance;
1885 - 'task' (optional): Task instance;
1886 - 'handle' (optional): Handle instance;
1887 - 'protocol' (optional): Protocol instance;
1888 - 'transport' (optional): Transport instance;
1889 - 'socket' (optional): Socket instance;
1890 - 'source_traceback' (optional): Traceback of the source;
1891 - 'handle_traceback' (optional): Traceback of the handle;
1892 - 'asyncgen' (optional): Asynchronous generator that caused
1893 the exception.
1894
1895 New keys maybe introduced in the future.
1896
1897 Note: do not overload this method in an event loop subclass.
1898 For custom exception handling, use the
1899 `set_exception_handler()` method.
1900 """
1901 if self._exception_handler is None:
1902 try:
1903 self.default_exception_handler(context)
1904 except (SystemExit, KeyboardInterrupt):
1905 raise
1906 except BaseException:
1907 # Second protection layer for unexpected errors
1908 # in the default implementation, as well as for subclassed
1909 # event loops with overloaded "default_exception_handler".
1910 logger.error('Exception in default exception handler',
1911 exc_info=True)
1912 else:
1913 try:
1914 ctx = None
1915 thing = context.get("task")
1916 if thing is None:
1917 # Even though Futures don't have a context,
1918 # Task is a subclass of Future,
1919 # and sometimes the 'future' key holds a Task.
1920 thing = context.get("future")
1921 if thing is None:
1922 # Handles also have a context.
1923 thing = context.get("handle")
1924 if thing is not None and hasattr(thing, "get_context"):
1925 ctx = thing.get_context()
1926 if ctx is not None and hasattr(ctx, "run"):
1927 ctx.run(self._exception_handler, self, context)
1928 else:
1929 self._exception_handler(self, context)
1930 except (SystemExit, KeyboardInterrupt):
1931 raise
1932 except BaseException as exc:
1933 # Exception in the user set custom exception handler.
1934 try:

Callers 1

shutdown_asyncgensMethod · 0.95

Calls 6

hasattrFunction · 0.85
errorMethod · 0.45
getMethod · 0.45
get_contextMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected