Sets an uncaught exception handler. This will make the process exit with
exit code 1 if a thread exits due to an uncaught exception.
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);
        }
      });
  }
766646
def example_exc_handler(tries_remaining, exception, delay):
    

    print >> stderr, "Caught '{0}', {1} tries remaining, \
    sleeping for {2} seconds".format(exception, tries_remaining, delay)
696983
protected function initExceptionHandler()
    {
        if (!isset($this->chainedExceptionHandler)) {
            $this->chainedExceptionHandler = $this->setExceptionHandler([$this, 'handleException']) ?: false;
        }
    }
824802
def system_exit_exception_handler(*args):
    

    reporter = Reporter()
    reporter.Footer_label.setText(
        "The severity of this exception is critical, <b>{0}</b> cannot continue and will now close!".format(
            Constants.application_name))

    base_exception_handler(*args)

    foundations.core.exit(1)

    return True
877137
def exception_handling(exception_handler, control)
      begin
        yield
      
      rescue => exception
        # If we have an exception handler, it gets handed all the exceptions. 
        # No exceptions stop the operation. 
        if exception_handler
          exception_handler.call(exception, control)
        else
          raise
        end
      end
    end
1004564
public synchronized void setFailure(Exception paramE) {
        if (done)
            return; // can't mark done twice
        e = paramE;
        done = true;
        notifyAll();

        // if we have a callback to call, schedule
        // it on a different thread. Who knows what this
        // thread is doing.
        if (callback != null) {
            QueueBuffer.executor.submit(new Callable<Void>() {
                public Void call() throws Exception {
                    callback.onError(e);
                    return null;
                }
            });

        }

    }
524568
function ExitHandler( exiting, error ) {
	if( error ) {
		if( error.stack ) {
			console.error( error.stack );
		}

		process.exit( 1 );
	}

	if( exiting.now ) {
		process.exit( 0 ); // exit now
	}

	console.log('\n');

	process.exit( 0 ); // now exit with a smile :)
}
254269
def set_exception(self, exception, traceback=None):
        
        if not isinstance(exception, BaseException):
            raise RuntimeError("Exception must be of BaseException type")
        self._exception = exception
        self._traceback = traceback
        self._event.set()
        self._invoke_callbacks()
434066
def handle_unhandled_exception(exc_type, exc_value, exc_traceback):
    """"""
    if issubclass(exc_type, KeyboardInterrupt):
        # call the default excepthook saved at __excepthook__
        sys.__excepthook__(exc_type, exc_value, exc_traceback)
        return
    logger = logging.getLogger(__name__) # type: ignore
    logger.critical("Unhandled exception", exc_info=(exc_type, exc_value, exc_traceback))
355941
def setup_celluloid_exception_handler
      Celluloid.task_class = defined?(Celluloid::TaskThread) ? Celluloid::TaskThread : Celluloid::Task::Threaded
      Celluloid.exception_handler do |ex|
        puts ex unless filtered_error?(ex)
      end
    end
473788
private void exceptionCaught(Exception e) {
        PeerAddress addr = getAddress();
        String s = addr == null ? "?" : addr.toString();
        if (e instanceof ConnectException || e instanceof IOException) {
            // Short message for network errors
            log.info(s + " - " + e.getMessage());
        } else {
            log.warn(s + " - ", e);
            Thread.UncaughtExceptionHandler handler = Threading.uncaughtExceptionHandler;
            if (handler != null)
                handler.uncaughtException(Thread.currentThread(), e);
        }

        close();
    }
380955
def setThrowException(self, setting):
        
        if setting:
            self._throwException = True
            self._findFailedResponse = "ABORT"
        else:
            self._throwException = False
            self._findFailedResponse = "SKIP"
374321
public void setException(Throwable exception) {
    this.exception = exception;

    if (handlers != null) {
      for (IsSimplePromiseResponseHandler<T> h : handlers) {
        h.onResponse(this);
      }
    }
  }
1101321
def _log_unhandled_exception_and_exit(cls, exc_class=None, exc=None, tb=None, add_newline=False):
    """"""
    exc_class = exc_class or sys.exc_info()[0]
    exc = exc or sys.exc_info()[1]
    tb = tb or sys.exc_info()[2]

    # This exception was raised by a signal handler with the intent to exit the program.
    if exc_class == SignalHandler.SignalHandledNonLocalExit:
      return cls._handle_signal_gracefully(exc.signum, exc.signame, exc.traceback_lines)

    extra_err_msg = None
    try:
      # Always output the unhandled exception details into a log file, including the traceback.
      exception_log_entry = cls._format_unhandled_exception_log(exc, tb, add_newline,
                                                                should_print_backtrace=True)
      cls.log_exception(exception_log_entry)
    except Exception as e:
      extra_err_msg = 'Additional error logging unhandled exception {}: {}'.format(exc, e)
      logger.error(extra_err_msg)

    # Generate an unhandled exception report fit to be printed to the terminal (respecting the
    # Exiter's should_print_backtrace field).
    stderr_printed_error = cls._format_unhandled_exception_log(
      exc, tb, add_newline,
      should_print_backtrace=cls._should_print_backtrace_to_terminal)
    if extra_err_msg:
      stderr_printed_error = '{}\n{}'.format(stderr_printed_error, extra_err_msg)
    cls._exit_with_failure(stderr_printed_error)
761182
@Override
  public void registerErrorHandler(final EventHandler<Exception> handler) {
    this.clientEventListener.registerErrorHandler(handler);
    this.serverEventListener.registerErrorHandler(handler);
  }
316644
@Override
	public void setException(@NotNull Throwable e) {
		assert !isComplete();
		exception = e;
		completeExceptionally(e);
	}
249032
public static <T extends Exception> void exception(Class<T> exceptionClass, ExceptionHandler<? super T> handler) {
        getInstance().exception(exceptionClass, handler);
    }