Register exception handler.
765926
protected function registerExceptionHandler()
    {
        $previousHandler = null;
        if ($this->app->bound(ExceptionHandlerInterface::class) === true) {
            $previousHandler = $this->app->make(ExceptionHandlerInterface::class);
        }

        $this->app->singleton(ExceptionHandlerInterface::class, function () use ($previousHandler) {
            return new JsonApiExceptionHandler($this->app, $previousHandler);
        });
    }
238418
def exception_handler(self, callback):
        
        path = '.'.join([callback.__module__, callback.__name__])
        self._exception_handlers.append(path)
        return callback
866140
def class_register(cls):
    """"""
    cls.handler_registry = {}
    for method_name in dir(cls):
        method = getattr(cls, method_name)
        if hasattr(method, '_handle'):
            cls.handler_registry.update({method._handle: method_name})
    return cls
769922
protected function registerException()
    {
        $this->app->singleton('Nano7\Foundation\Contracts\Exception\ExceptionHandler', function ($app) {
            $except = new \Nano7\Foundation\Exception\ExceptionHandler();

            // Verificar se view foi adicionada
            if ($app->resolved('view')) {
                $except->setViewService($app['view']);
            }

            return $except;
        });
    }
245931
private function setup_exception_handler() {
		// Setup our classes default exception handler, in case anything escapes our other catches
		set_exception_handler( array( $this, 'generic_exception_handler' ) );

		// Register an error handler through our Router's catcher
		$this->response->onError( function( $response, $error_message, $error_type, $exception ) {

			// Check if we have a callable handler in our controller
			$callable = $this->get_controller_callable( 'exception_handler' );

			// Did we actually get a callable?
			if ( $callable !== false ) {
				// Call the found handler
				return call_user_func_array(
					$callable, // The array of the callable
					array( $error_message, $error_type, $exception ) // Arguments
				);
			}
			// We didn't get a callable
			else {
				// Pass the exception to our Paulus-defined exception handler
				$this->generic_exception_handler( $exception );
			}
		});
	}
909812
public function register()
    {
        if (env('USE_JSON_EXCEPTION_HANDLER', false)) {
            $this->app->bind(
                \Illuminate\Contracts\Debug\ExceptionHandler::class,
                'RobRogers3\LaravelExceptionHandler\JsonAwareExceptionHandler'
            );
        }
        
    }
172488
protected function registerErrorHandling()
    {
        mysqli_report(MYSQLI_REPORT_STRICT);
        
        set_error_handler(function ($level, $message, $file = '', $line = 0) {
            if (error_reporting() & $level) {
                throw new ErrorException($message, 0, $level, $file, $line);
            }
        });
        
        set_exception_handler(function ($e) {
            $this->handleUncaughtException($e);
        });
        
        register_shutdown_function(function () {
            if (! is_null($error = error_get_last()) && $this->isFatalError($error['type'])) {
                $this->handleUncaughtException(new FatalErrorException(
                    $error['message'], $error['type'], 0, $error['file'], $error['line']
                ));
            }
        });
    }
749120
def handling_exceptions(self):
        """"""
        try:
            if self.using_jobs:
                with handling_broken_process_pool():
                    yield
            else:
                yield
        except SystemExit as err:
            self.register_error(err.code)
        except BaseException as err:
            if isinstance(err, CoconutException):
                logger.display_exc()
            elif not isinstance(err, KeyboardInterrupt):
                traceback.print_exc()
                printerr(report_this_text)
            self.register_error(errmsg=err.__class__.__name__)
197170
def _call_exception_handlers(exception):
  """"""
  for handler in EXCEPTION_HANDLERS:
    try:
      if handler.wants(exception):
        handler.handle(exception)
    except:  # pylint: disable=bare-except
      try:
        # We don't want to stop for exceptions in the exception handlers but
        # we shouldn't hide them either.
        logging.error(traceback.format_exc())
      except:  # pylint: disable=bare-except
        # In case even the logging statement fails, ignore.
        pass
936018
def register(cls, *args, **kwargs):
        """"""
        if cls.app is None:
            return register(*args, handler=cls, **kwargs)
        return cls.app.register(*args, handler=cls, **kwargs)
1316305
public function register()
    {
        // Handle case-insensitivity of class names.
        $this->newClasses    = $this->arrayKeysToLowercase($this->newClasses);
        $this->newExceptions = $this->arrayKeysToLowercase($this->newExceptions);

        // Add the Exception classes to the Classes list.
        $this->newClasses = array_merge($this->newClasses, $this->newExceptions);

        $targets = array(
            \T_NEW,
            \T_CLASS,
            \T_DOUBLE_COLON,
            \T_FUNCTION,
            \T_CLOSURE,
            \T_CATCH,
        );

        if (\defined('T_ANON_CLASS')) {
            $targets[] = \T_ANON_CLASS;
        }

        if (\defined('T_RETURN_TYPE')) {
            $targets[] = \T_RETURN_TYPE;
        }

        return $targets;
    }
472734
def _construct_error_handling(self):
        
        self._app.register_error_handler(500, LambdaErrorResponses.generic_service_exception)
        self._app.register_error_handler(404, LambdaErrorResponses.generic_path_not_found)
        self._app.register_error_handler(405, LambdaErrorResponses.generic_method_not_allowed)
1277688
def exception_handler(exceptionObj):
    """"""
    try:
        if isinstance(exceptionObj, Exception) and hasattr(exceptionObj, 'args'):
            if not (hasattr(exceptionObj, 'message' or hasattr(exceptionObj, 'msg'))):
                if len(exceptionObj.args) >= 1:
                    if type(exceptionObj.args[0]) == type(b''):
                        ob = json.loads(exceptionObj.args[0].decode('utf-8'))
                        if type(ob) == type({}) and ob['message']:
                            return ob['message']
                    else:

                        try:
                            if type(exceptionObj.args[0]) == type('') and exceptionObj.args[0][0] == 'b':
                                ob = json.loads(exceptionObj.args[0][2:-1])
                            else:
                                ob = json.loads(exceptionObj.args[0])
                            if type(ob) == type({}) and ob['message']:
                                try:
                                    return exception_handler(ob['message'])
                                except Exception as e:
                                    return ob['message']
                            elif type(ob) == type({}) and ob['msg']:
                                try:
                                    return exception_handler(ob['message'])
                                except Exception as e:
                                    return ob['msg']
                            return str(json.loads(exceptionObj.args[0]))
                        except Exception as e:
                            return str(exceptionObj.args[0])
            elif hasattr(exceptionObj, 'msg'):
                return exceptionObj.msg
            elif hasattr(exceptionObj, 'message'):
                return exceptionObj.message
        elif type(exceptionObj) == type(''):
            try:
                ob = json.loads(exceptionObj)
                if type(ob) == type({}):
                    if ob['message']:
                        return ob['message']
                    elif ob['msg']:
                        return ob['msg']
                    else:
                        return ob
            except Exception as e:
                return exceptionObj

    except Exception as e:
        return e
546049
public void register() throws Exception {
        ChannelFuture future = loop.register(this);
        assert future.isDone();
        Throwable cause = future.cause();
        if (cause != null) {
            PlatformDependent.throwException(cause);
        }
    }
293569
public function register()
    {
        if (!$this->registered) {
            error_reporting($this->errorLevel);
            set_exception_handler([$this, 'handleException']);
            set_error_handler([$this, 'handleError'], $this->errorLevel);
            register_shutdown_function([$this, 'handleShutdown']);

            $this->registered = true;
        }

        return $this;
    }
205301
protected function defineExceptionHandler()
    {
        $exceptionRender = $this->obtainExceptionRender();
        
        //If not render to use
        if ($exceptionRender === false) {
            return;
        }
        
        //add the handler for exceptions
        set_exception_handler([$this, 'exceptionHandler']);
        
        \BFW\Application::getInstance()
            ->getMonolog()
            ->getLogger()
            ->debug('New exception handler defined.')
        ;
    }
437196
def configure_error_handlers(graph):
    
    # override all of the werkzeug HTTPExceptions
    for code in default_exceptions.keys():
        graph.flask.register_error_handler(code, make_json_error)

    # register catch all for user exceptions
    graph.flask.register_error_handler(Exception, make_json_error)