(self, context)
Default exception handler.

        This is called when an exception occurs and no exception
        handler is set, and can be called by a custom exception
        handler that wants to defer to the default behavior.

        This default handler logs the error message and other
        context-dependent information.  In debug mode, a truncated
        stack trace is also appended showing where the given object
        (e.g. a handle or future or task) was created, if any.

        The context parameter has the same meaning as in
        `call_exception_handler()`.
Default exception handler.
Default exception handler .
def default_exception_handler(self, context):
        """Default exception handler.

        This is called when an exception occurs and no exception
        handler is set, and can be called by a custom exception
        handler that wants to defer to the default behavior.

        This default handler logs the error message and other
        context-dependent information.  In debug mode, a truncated
        stack trace is also appended showing where the given object
        (e.g. a handle or future or task) was created, if any.

        The context parameter has the same meaning as in
        `call_exception_handler()`.
        """
        message = context.get('message')
        if not message:
            message = 'Unhandled exception in event loop'

        exception = context.get('exception')
        if exception is not None:
            exc_info = (type(exception), exception, exception.__traceback__)
        else:
            exc_info = False

        if ('source_traceback' not in context and
                self._current_handle is not None and
                self._current_handle._source_traceback):
            context['handle_traceback'] = \
                self._current_handle._source_traceback

        log_lines = [message]
        for key in sorted(context):
            if key in {'message', 'exception'}:
                continue
            value = context[key]
            if key == 'source_traceback':
                tb = ''.join(traceback.format_list(value))
                value = 'Object created at (most recent call last):\n'
                value += tb.rstrip()
            elif key == 'handle_traceback':
                tb = ''.join(traceback.format_list(value))
                value = 'Handle created at (most recent call last):\n'
                value += tb.rstrip()
            else:
                value = repr(value)
            log_lines.append(f'{key}: {value}')

        logger.error('\n'.join(log_lines), exc_info=exc_info)
def default_exception_handler ( self , context ) : message = context . get ( 'message' ) if not message : message = 'Unhandled exception in event loop' exception = context . get ( 'exception' ) if exception is not None : exc_info = ( type ( exception ) , exception , exception . __traceback__ ) else : exc_info = False if ( 'source_traceback' not in context and self . _current_handle is not None and self . _current_handle . _source_traceback ) : context [ 'handle_traceback' ] = self . _current_handle . _source_traceback log_lines = [ message ] for key in sorted ( context ) : if key in { 'message' , 'exception' } : continue value = context [ key ] if key == 'source_traceback' : tb = '' . join ( traceback . format_list ( value ) ) value = 'Object created at (most recent call last):\n' value += tb . rstrip ( ) elif key == 'handle_traceback' : tb = '' . join ( traceback . format_list ( value ) ) value = 'Handle created at (most recent call last):\n' value += tb . rstrip ( ) else : value = repr ( value ) log_lines . append ( f'{key}: {value}' ) logger . error ( '\n' . join ( log_lines ) , exc_info = exc_info )