Register error handlers.
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)
509887
private function reportErrors()
    {
        if ( ! $this->errorReporting)
        {
            return;
        }

        set_error_handler([get_class(), 'errorHandler']);

        if ( ! empty($this->errors))
        {
            $this->isBufferReturned = true;
        }

        foreach ($this->errors as $error)
        {
            trigger_error($error->getMessage(), $error->getLevel());
        }

        restore_error_handler();
    }
1345395
public function register()
    {
        if (empty($this->formatterStack)) {
            throw new NoFormattersRegisteredException(
                'No formatters were registered before attempting to register the error handler'
            );
        }

        // We want the formatters we register to handle the errors.
        ini_set('display_errors', false);

        set_error_handler([$this, self::ERROR_HANDLER]);
        set_exception_handler([$this, self::EXCEPTION_HANDLER]);
        register_shutdown_function([$this, self::SHUTDOWN_HANDLER]);
    }
1126739
public function register()
    {
        $errorLevel = $this->config('errorLevel');
        set_error_handler([$this, 'handleError'], $errorLevel);
        set_exception_handler([$this, 'handle']);
        register_shutdown_function(function () {
            if (PHP_SAPI === 'cli') {
                return;
            }
            $error = error_get_last();
            if (!is_array($error)) {
                return;
            }
            $fatals = [
                E_USER_ERROR,
                E_ERROR,
                E_PARSE,
            ];
            if (!in_array($error['type'], $fatals, true)) {
                return;
            }
            $this->handleFatalError(
                $error['type'],
                $error['message'],
                $error['file'],
                $error['line']
            );
        });
    }
846322
protected function registerErrorHandling()
    {
        error_reporting(-1);

        set_error_handler(function ($level, $message, $file = '', $line = 0) {
            if (error_reporting() & $level) {
                // ignore ACF non-numeric issue on PHP 7.1.x until it is fixed
                if (stripos($file, 'acf-repeater/views/field.php') !== false && $message === 'A non-numeric value encountered') {
                    return false;
                }
                // ignore wordpress test cases
                if ($message === '/tmp/wordpress-tests-lib/includes/../data/themedir1 is not readable') {
                    return false;
                }

                throw new ErrorException($message, 0, $level, $file, $line);
            }
        });

        set_exception_handler(function ($e) {
            $this->handleUncaughtException($e);
        });

        register_shutdown_function(function () {
            $this->handleShutdown();
        });
    }
1070357
public static function initialiseErrorHandler()
    {
        // Initialise logging
        self::initialiseLog();
        GenericExceptionHandler::initialise(self::Log());
        GenericErrorHandler::initialise(self::Log());
    }
923383
private void registerHandlers() {
    // Register TCP message handlers.
    bootstrapService.getMessagingService().registerHandler(MEMBERSHIP_SYNC, syncHandler, swimScheduler);
    bootstrapService.getMessagingService().registerHandler(MEMBERSHIP_PROBE, probeHandler, swimScheduler);
    bootstrapService.getMessagingService().registerHandler(MEMBERSHIP_PROBE_REQUEST, probeRequestHandler);

    // Register UDP message listeners.
    bootstrapService.getUnicastService().addListener(MEMBERSHIP_GOSSIP, gossipListener, swimScheduler);
  }
908678
def register_errors_handler(self, callback, *custom_filters, exception=None, run_task=None, **kwargs):
        
        filters_set = self.filters_factory.resolve(self.errors_handlers,
                                                   *custom_filters,
                                                   exception=exception,
                                                   **kwargs)
        self.errors_handlers.register(self._wrap_async_task(callback, run_task), filters_set)
716549
protected function registerFailingQueueHandler()
    {
        if ($this->eye->laravelVersionIs('>=', '5.2.0')) {
            app(QueueManager::class)->failing(function (JobFailed $e) {
                $this->eye->queue()->failedQueue($e->connectionName,
                                                      $e->job->resolveName(),
                                                      $e->job->getQueue());
            });
        } else {
            app(QueueManager::class)->failing(function ($connection, $job, $data) {
                $this->eye->queue()->failedQueue($connection,
                                                      $this->eye->queue()->resolveLegacyName($job),
                                                      $job->getQueue());
            });
        }
    }
1283089
protected function registerFatalHandler()
    {
        $error = $this;

        // When shutdown, the current working directory will be set to the web
        // server directory, store it for later use
        $cwd = getcwd();

        register_shutdown_function(function () use ($error, $cwd) {
            $e = error_get_last();
            if (!$e || !in_array($e['type'], array(E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE))) {
                // No error or not fatal error
                return;
            }

            ob_get_length() && ob_end_clean();

            // Reset the current working directory to make sure everything work as usual
            chdir($cwd);

            $exception = new \ErrorException($e['message'], $e['type'], 0, $e['file'], $e['line']);

            if ($error->triggerHandler('fatal', $exception)) {
                // Handled!
                return;
            }

            // Fallback to error handlers
            if ($error->triggerHandler('error', $exception)) {
                // Handled!
                return;
            }

            // Fallback to internal error Handlers
            $error->internalHandleException($exception);
        });
    }
1304972
@Override
	public void registerErrorHandler(ErrorHandler handler) {
		if (handler != null) {
			this.errorHandlers.add(handler);
			Collections.sort(this.errorHandlers, DefaultErrorManager.PRIORITY_COMPARATOR);
		}
	}
275531
function registerHandlers(handlers, commandStack) {
  forEach(handlers, function(handler, id) {
    commandStack.registerHandler(id, handler);
  });
}
1332098
def _defaultErrorHandler(varBinds, **context):
        """"""
        errors = context.get('errors')

        if errors:
            err = errors[-1]
            raise err['error']
1185184
def add_error_handler(self, error_input):
        

        if isinstance(error_input, dict):
            error_response = error_input.get('response', {})
            cerr = error_response.get('command_error', NoResponse)
            qerr = error_response.get('query_error', NoResponse)

            response_dict = {'command_error': cerr,
                             'query_error': qerr}

            register_list = error_input.get('status_register', [])

            for register_dict in register_list:
                query = register_dict['q']
                register = StatusRegister(register_dict)
                self._status_registers[to_bytes(query)] = register
                for key in register.keys():
                    self._error_map[key] = register

            queue_list = error_input.get('error_queue', [])

            for queue_dict in queue_list:
                query = queue_dict['q']
                err_queue = ErrorQueue(queue_dict)
                self._error_queues[to_bytes(query)] = err_queue

        else:
            response_dict = {'command_error': error_input,
                             'query_error': error_input}

        for key, value in response_dict.items():
            self._error_response[key] = to_bytes(value)
751612
public function setErrorHandler()
    {
        set_error_handler(function ($errno, $errstr, $errfile, $errline ) {
            throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
        });
    }
1002351
private function registerErrorRenderer()
    {
        if ($this->kernel()->isCli()) {
            $this->container()->bind(ErrorRendererContract::class, ConsoleErrorRenderer::class);
        } else {
            $this->container()->bind(ErrorRendererContract::class, HttpErrorRenderer::class);
        }
    }
447233
def handle_errors(resp):
    """"""
    if resp.status_code == 400:
        raise ApiException(json.loads(resp.content).get('message'))
    return resp