Sets PHP error handlers
553697
protected function setErrorHandlers()
    {
        register_shutdown_function(array($this->logger, 'shutdownHandler'));
        set_exception_handler(array($this->logger, 'exceptionHandler'));
        set_error_handler(array($this->logger, 'errorHandler'), error_reporting());
    }
997456
private function errors()
    {
        if (env('DEV_MODE')) {
            $whoops = new \Whoops\Run();
            $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
            $whoops->register();
        }
    }
989912
def error_handler(f):
    """"""
    @wraps(f)
    def inner(*args, **kwargs):
        try:
            return f(*args, **kwargs)
        except NoResultFound:
            abort(404)
        except IntegrityError:
            abort(500)
    return inner
817100
function serve(array $urls)
	{
        $_SESSION['toto'] = 'prout';
        $response = null;

        // Registering PHP error handlers.
        set_error_handler(array($this, 'php_error_handler'), E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR);

        try {
            $handler = $this->route($urls);
            $response = $this->process($handler);
            $this->display($response);
        }
        catch(HttpRedirect $r) {
            $response = Injector::give('Response');
            $response->setHeader('Location', $r->getUrl());
        }
        catch(HTTPClientError $e) {
            $response = call_user_func($this->error40x, $e);
        }
        catch(HTTPServerError $e) {
            $response = call_user_func($this->error50x, $e);
        }
        // Generic HTTP status response.
        catch(HTTPStatus $s) {
            $response = Injector::give('Response', $s->getMessage(), $s->getCode());
        }
        // Generic error.
        catch(\Exception $e) {
            $response = call_user_func($this->error50x, $e);
        }
	}
1003112
def setValidityErrorHandler(self, err_func, warn_func, arg=None):
        
        libxml2mod.xmlSetValidErrors(self._o, err_func, warn_func, arg)
247984
protected function restoreErrorContext()
    {
        if (!Mage::getStoreConfigFlag('system/cron/enableErrorLog')) {
            return;
        }

        restore_error_handler();
        foreach ($this->errorSettingsBackup as $key => $value) {
            ini_set($key, $value);
        }
    }
265208
public function PHPShutdownHandler()
    {
        session_write_close();
        if ($lasterror = error_get_last()) {
            $message = $lasterror['message'] . ' | File: {file} | Ln: {line}';
            $context = array(
                'file' => $lasterror['file'],
                'line' => $lasterror['line']
            );
            $this->logger->log($this->shutdownLogLevel, $message, $context);
        }
    }
1291472
private function registerErrorHandler(): void
    {
        $whoops = new Run();
        $whoops->pushHandler(new PrettyPageHandler());
        $whoops->register();

        $this->errorHandler = $whoops;
    }
559922
protected function initErrorHandler()
    {
        if (!isset($this->chainedErrorHandler)) {
            $this->chainedErrorHandler = $this->setErrorHandler([$this, 'handleError']) ?: false;
        }
    }
12684
public function php_error_handler($errno, $errstr, $errfile, $errline)
    {
        $e = new \Exception($errstr, $errno);
        call_user_func($this->error50x, $e);
    }
704188
protected function defineErrorHandler()
    {
        $errorRender = $this->obtainErrorRender();
        
        //If not render to use
        if ($errorRender === false) {
            return;
        }

        //add the handler for errors
        set_error_handler([$this, 'errorHandler']);
        
        \BFW\Application::getInstance()
            ->getMonolog()
            ->getLogger()
            ->debug('New error handler defined.')
        ;
    }
673211
def set_error_callback(self, callback):
        
        self.logger.debug('Setting error callback: %r', callback)
        self._on_error = callback
326087
private function SetErrCode()
    {
        $connection_status = @pg_connection_status($this->conn);
        $last_error = @pg_last_error($this->conn);
        $result_error = @pg_result_error($this->conn);
        $last_notice = @pg_last_notice($this->conn);

        $_errors = array();

        if ($connection_status) {
            $_errors[] = ($connection_status?$connection_status:'');
        }
        if ($last_error) {
            $_errors[] = ($last_error?$last_error:'');
        }
        if ($result_error) {
            $_errors[] = ($result_error?$result_error:'');
        }
        if ($last_notice) {
            $_errors[] = ($last_notice?$last_notice:'');
        }

        if (count($_errors) > 0) {
            //$this->errStr .= '<div style="border:1px solid black; margin:4px; padding:4px; background-color:#FFDEAD;"><b>Query:</b> '.$this->last_query . '<br />'.implode('<br />', $_errors)."</div>";
            if ($_REQUEST[act]=='api') {
                foreach ($_errors as $_error) {
                    $lines=explode("\n", $_error);
                    $api_errors[]=$lines;
                }
                $err_string=json_encode(['error'=>'DB_error','errors'=>$api_errors]);//exit;
            } else {
                $err_string='<div class="alert alert-error"><h2>DB Error</h2><b>Query:</b> '.$this->last_query . '<br /><pre class="red">'.implode('<br />', $_errors)."</pre></div>";
            }
            $this->errStr .= $err_string;
            //$this->errStr .="<pre>".print_r($GLOBALS)."</pre>";
            $GLOBALS[no_refresh]=1;
        }
    }
569699
function (isGlobal, server, err, msg, session, resp, opts, cb) {
  let handler;
  if (isGlobal) {
    handler = server.app.get(Constants.RESERVED.GLOBAL_ERROR_HANDLER);
  } else {
    handler = server.app.get(Constants.RESERVED.ERROR_HANDLER);
  }
  if (!handler) {
    logger.debug('no default error handler to resolve unknown exception. ' + err.stack);
    utils.invokeCallback(cb, err, resp, opts);
  } else {
    if (handler.length === 5) {
      handler(err, msg, resp, session, cb);
    } else {
      handler(err, msg, resp, session, opts, cb);
    }
  }
}
741429
@Override
    public void setErrorHandler(ErrorHandler handler) {
        if (errorHandlerLocked) {
            return;
        }
        if (handler == null) {
            handler = base;
        }
        this.errorHandler = handler;
    }
1011717
public function setErrorHandling( $errorHandling )
    {
        if ( $errorHandling != eZDB::ERROR_HANDLING_EXCEPTIONS &&
             $errorHandling != eZDB::ERROR_HANDLING_STANDARD )
            throw new RuntimeException( "Unknown eZDB error handling mode $errorHandling" );

        $this->errorHandling = $errorHandling;
    }
565575
def add_error_handlers(app):
    """"""

    def handle_validation_error(error):
        response = jsonify({'message': str(error)})
        response.status_code = error.status_code
        return response

    app.errorhandler(ValidationError)(handle_validation_error)