Log unhandled exceptions from anywhere in the event loop.
322997
def exception(self, loop: asyncio.BaseEventLoop, context: dict) -> None:
        ''''''

        Log.error('unhandled exception: %s', context['message'])
        Log.error('%s', context)
        if 'exception' in context:
            Log.error('  %s', context['exception'])
40256
def _excepthook(self, etype, evalue, trace):
        
        if etype == ArgumentParserError:
            self.exit(code=CRITICAL,
                      message='error: {0}'.format(evalue),
                      extdata=self.parser.format_usage())
        else:
            self.exit(code=UNKNOWN,
                      message='Uncaught exception: {0} - {1}'
                              .format(etype.__name__, evalue),
                      extdata=''.join(traceback.format_tb(trace)))
805256
public void log(Exception e, Object... elements) {
		if(willWrite.compareTo(Level.ERROR)<=0) {
			StringBuilder sb = buildLine(Level.ERROR, new StringBuilder(),elements);
		
			if(context==null) {
				sb.append(e.toString());
				System.out.println(sb.toString());
			} else {
				context.log(sb.toString(),e);
			}
		}
	}
939677
protected void handleErrors(Collection<Throwable> errors, Object event) {

    if (this.globalExceptionHandler == null) {
      for (Throwable error : errors) {
        LOG.error("Failed to dispatch event {}", event, error);
      }
    } else {
      this.globalExceptionHandler.handleErrors(event, errors.toArray(new Throwable[errors.size()]));
    }
  }
1147336
def try_except_handler(self, node):
        """"""
        # List all excepted exception's names
        excepted_types = []
        for handler in node.handlers:
            if handler.type is None:
                excepted_types = None
                break

            if isinstance(handler.type, ast.Tuple):
                excepted_types.extend([exception_type for exception_type
                                       in handler.type.elts])

            else:
                excepted_types.append(handler.type)

        new_exception_list = self.ignore_exceptions

        if self.ignore_exceptions is not None:
            if excepted_types is None:
                new_exception_list = None
            else:
                new_exception_list = list(set(excepted_types +
                                              self.ignore_exceptions))

        # Set the new ignore list, and save the old one
        old_exception_handlers, self.ignore_exceptions = \
            self.ignore_exceptions, new_exception_list

        # Run recursively on all sub nodes with the new ignore list
        node.body = [self.visit(node_item) for node_item in node.body]

        # Revert changes from ignore list
        self.ignore_exceptions = old_exception_handlers
90253
def _exception_free_callback(self, callback, *args, **kwargs):
        
        try:
            return callback(*args, **kwargs)
        except Exception:
            self._logger.exception("An exception occurred while calling a hook! ",exc_info=True)
            return None
1263448
def __global_logging_exception_handler(exc_type, exc_value, exc_traceback):
    '''
    
    '''
    if exc_type.__name__ == "KeyboardInterrupt":
        # Do not log the exception or display the traceback on Keyboard Interrupt
        # Stop the logging queue listener thread
        if is_mp_logging_listener_configured():
            shutdown_multiprocessing_logging_listener()
    else:
        # Log the exception
        logging.getLogger(__name__).error(
            'An un-handled exception was caught by salt\'s global exception '
            'handler:\n%s: %s\n%s',
            exc_type.__name__,
            exc_value,
            ''.join(traceback.format_exception(
                exc_type, exc_value, exc_traceback
            )).strip()
        )
        # Call the original sys.excepthook
        sys.__excepthook__(exc_type, exc_value, exc_traceback)
522567
def logged_exception(self, e):
        
        if str(e) not in self._errors:
            self._errors.append(str(e))

        self.set_error_state()
        self.buildstate.state.exception_type = str(e.__class__.__name__)
        self.buildstate.state.exception = str(e)
1198290
def exception(self, msg=None, *args, **kwargs):
        
        kwargs['exc_info'] = 1
        return self._log(logging.ERROR, msg, args, kwargs)
7983
public static void makeProcessExitOnUncaughtException(final Log log) {
    Thread.setDefaultUncaughtExceptionHandler(
      new Thread.UncaughtExceptionHandler() {
        @Override
        public void uncaughtException(Thread t, Throwable e) {
          log.error("UNCAUGHT: Thread " + t.getName() +
            " got an uncaught exception", e);
          System.exit(1);
        }
      });
  }
637799
public static void silenceUncaughtExceptionsInThisThread() {
        Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
            @Override
            public void uncaughtException(Thread ignored, Throwable ignored1) {
            }
        });
    }
1205446
def _except_if_failed(cls, event):
        """"""
        if event.success is None:
            raise IOTSyncTimeout('Requested timed out', event)
        if not event.success:
            msg = "Request failed, unknown error"
            if isinstance(event.payload, Mapping):
                if P_MESSAGE in event.payload:
                    msg = event.payload[P_MESSAGE]
                try:
                    exc_class = cls.__exception_mapping[event.payload[P_CODE]]
                except KeyError:
                    pass
                else:
                    raise exc_class(msg, event)

            raise IOTException(msg, event)
241033
function UncaughtExceptionHandler(error) {
    // Call module.exports.crit here so that we can intercept the call in the tests
    module.exports.crit(`Unhandled exception: ${error.message}`);
    module.exports.crit(error.stack.toString());
    process.exit(1);
}
638578
def dump_to_log(self):
        
        if self._event_dict:
            logger.info('Events:')
            for event_str, count_int in sorted(self._event_dict.items()):
                logger.info('  {}: {}'.format(event_str, count_int))
        else:
            logger.info('No Events')
1275270
def _log_exception(self, exception):
        
        self._io.error(str(exception).strip().split(os.linesep))
34145
def _unhandled_event_default(event):
        
        if isinstance(event, KeyboardEvent):
            c = event.key_code
            if c in (ord("X"), ord("x"), ord("Q"), ord("q")):
                raise StopApplication("User terminated app")
            if c in (ord(" "), ord("\n"), ord("\r")):
                raise NextScene()
923920
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis",
        "PMD.AvoidCatchingGenericException",
        "PMD.UseStringBufferForStringAppends", "PMD.SystemPrintln" })
    public void printError(Error event) {
        String msg = "Unhandled " + event;
        System.err.println(msg);
        if (event.throwable() == null) {
            System.err.println("No stack trace available.");
        } else {
            event.throwable().printStackTrace();
        }
    }