@inheritdoc

@throws \Throwable
540567
public function handle(ServerRequestInterface $request): ResponseInterface
    {
        $allowLayers = $this->store->getLayersForRequest($request);
        $this->runner->setLayers($allowLayers);

        $this->emit(self::EVENT_BEFORE_HANDLE, [$request, $allowLayers]);
        $response = $this->runner->handle($request);
		$this->emit(self::EVENT_AFTER_HANDLE, [$request, $allowLayers, $response]);

		return $response;
    }
1235434
function onUncaughtException(\Throwable $exception): void
    {
        try {
            // handle the exception
            try {
                $this->emit(ErrorHandlerEvents::EXCEPTION, $exception, $this->debug);
            } catch (\Throwable $e) {
                $exception = new ChainedException(
                    'Additional exception was thrown from an [exception] event listener. See previous exceptions.',
                    0,
                    Exception::joinChains($exception, $e)
                );
            }

            $this->invokeErrorScreen($exception);

            return;
        } catch (\Throwable $e) {
            $exception = new ChainedException(
                sprintf('Additional exception was thrown while trying to invoke %s. See previous exceptions.', get_class($this->errorScreen)),
                0,
                Exception::joinChains($exception, $e)
            );

            $this->emit(ErrorHandlerEvents::FAILURE, $exception, $this->debug);
        }

        // unhandled exception
        if ($this->debug && $this->printUnhandledExceptionInDebug) {
            echo Exception::render($exception, true, true);
        }
    }
793483
protected function namespaceHandler(Throwable $exception) : ?Throwable
    {
        if ($this->namespace && $exception instanceof ClientException) {
            return $exception->withNamespace($this->namespace);
        }

        return null;
    }
600817
public static function wrapException(\Throwable $exception): \Throwable
    {
        if ($exception instanceof ExceptionInterface) {
            return $exception;
        }

        if ($exception instanceof ConnectionException) {
            if ($exception instanceof ConnectionPDOException) {
                return new DatabaseException($exception->getMessage(), $exception->getCode(), $exception);
            }
            if ($exception instanceof ConnectionInvalidArgumentException) {
                return new InvalidArgumentException($exception->getMessage(), $exception->getCode(), $exception);
            }
            if ($exception instanceof ConnectionFileException) {
                return new FileException($exception->getMessage(), $exception->getCode(), $exception);
            }
        }

        if ($exception instanceof QueryScribeException) {
            if ($exception instanceof QueryScribeInvalidArgumentException) {
                return new InvalidArgumentException($exception->getMessage(), $exception->getCode(), $exception);
            }
            if ($exception instanceof QueryScribeInvalidReturnValueException) {
                return new InvalidReturnValueException($exception->getMessage(), $exception->getCode(), $exception);
            }
            if ($exception instanceof QueryScribeInvalidQueryException) {
                return new IncorrectQueryException($exception->getMessage(), $exception->getCode(), $exception);
            }
        }

        return $exception;
    }
539612
protected function _get(\Throwable $e)
	{
		$path_to_root = $_SERVER['DOCUMENT_ROOT'];

		$rows = array();
		
		// first row : current script with error line
		$rows[] = [
				// file		
				str_replace($path_to_root . '/', '', $e->getFile()),
			
				// line
				$e->getLine(),
			
				// function
				"throw new " . get_class($e),
			
				// function parameters
				""
			];
		

		
		// for each call stack element
		foreach ( $e->getTrace() as $trace )
		{
			$rows[] = [
					
					// file
					str_replace($path_to_root . '/', '', $trace['file']),
				
					// line
					$trace['line'],
				
					// function
					$trace['class'] ? ($trace['class'] . '::' . $trace['function']) : $trace['function'],
				
					// args
					print_r($trace['args'], true)
				];
		}
		
		
		return $rows;
	}
611178
public function exceptionHandler($throwable)
    {
        $report = Report::fromPHPThrowable(
            $this->client->getConfig(),
            $throwable
        );

        $report->setSeverity('error');
        $report->setUnhandled(true);
        $report->setSeverityReason([
            'type' => 'unhandledException',
        ]);

        $this->client->notify($report);

        if ($this->previousExceptionHandler) {
            call_user_func(
                $this->previousExceptionHandler,
                $throwable
            );
        }
    }
136426
public function notifyException($throwable, callable $callback = null)
    {
        $report = Report::fromPHPThrowable($this->config, $throwable);

        $this->notify($report, $callback);
    }
152594
public function addException(\Throwable $exception)
    {
        $memory = $this->getMemory();

        $exceptions = $this->unserialize($memory);

        $exceptions[] = get_class($exception) . ": " . $exception->getMessage() . " (" . $exception->getFile() . ":" . $exception->getLine() . ")";

        $data = serialize($exceptions);

        shmop_write($memory, $data, 0);
        shmop_close($memory);
    }
280936
public function captureThrowable(\Throwable $thrown, array $context = [])
    {
        $this->errorsStore->register(
            $this->eventFactory->createError($thrown, array_replace_recursive($this->sharedContext, $context))
        );
    }
634859
public function onExceptionHandle(\Throwable $e)
    {
        try {
            if ($e->getPrevious()) {
                $ce = $e->getPrevious();
                $errMsg = dump($ce, false, true);
            } else {
                $errMsg = dump($e, false, true);
                $ce = $e;
            }

            $this->getContext()->getLog()->error($errMsg);
            $this->outputJson(parent::$stdClass, 'Internal Server Error', 500);
        } catch (\Throwable $ne) {
            getInstance()->log->error('previous exception ' . dump($ce, false, true));
            getInstance()->log->error('handle exception ' . dump($ne, false, true));
        }
    }
279615
public function exceptionHandler(\Throwable $exception)
    {
        \BFW\Application::getInstance()
            ->getMonolog()
            ->getLogger()
            ->debug(
                'New exception catched.',
                [
                    'msg'  => $exception->getMessage(),
                    'file' => $exception->getFile(),
                    'line' => $exception->getLine()
                ]
            );
        
        $errorRender = $this->obtainExceptionRender();
        
        $this->callRender(
            $errorRender,
            'Exception Uncaught', 
            $exception->getMessage(), 
            $exception->getFile(), 
            $exception->getLine(), 
            $exception->getTrace(),
            $exception->getCode()
        );
    }
6894
public function log(\Throwable $throwable): void
    {
        $date = (new \DateTime())->format('Y-m-d H:i:s');
        $log = "[$date] {$throwable->getMessage()} at line {$throwable->getLine()} in {$throwable->getFile()}" . PHP_EOL;
        $dirname = dirname($this->logPath);

        if (!is_dir($dirname)) {
            mkdir($dirname, 0755);
        }

        $handle = fopen($this->logPath, 'a');
        fwrite($handle, $log);
        fclose($handle);
    }
183063
public function handleThrowable(ServerRequestInterface $request, ResponseInterface $response, Throwable $throwable)
    {
        return $this
            ->getContentTypeHandler($request)
            ->handleThrowable($request, $response, $throwable);
    }
1089412
public function logServerError(Throwable $e)
    {
        /** @var Handle $handle */
        $handle = $this->app->make(Handle::class);

        $handle->renderForConsole(new Output(), $e);

        $handle->report($e);
    }
788284
public static function exceptionHandler(\Throwable $e) {
		$code = $e->getCode();
		if (get_class($e) == 'Object\Error\UserException') {
			$code = -1;
		}
		self::$errors[] = [
			'errno' => $code,
			'error' => [$e->getMessage()],
			'file' => $e->getFile(),
			'line' => $e->getLine(),
			'code' => self::getCode($e->getFile(), $e->getLine()),
			'backtrace' => self::debugBacktraceString($e->getTrace())
		];
		self::$flag_exception = true;
		exit;
	}
1349885
protected function _throw($object)
    {
        $error = $object->errorInfo();
        throw new \RuntimeException(
            sprintf(
                'PDO operation returned SQLSTATE %s: Error %s (%s)',
                $error[0],
                $error[1],
                $error[2]
            )
        );
    }
1231496
public static function fromThrowable(\Throwable $throwable): self
    {
        return new self($throwable->getMessage(), (int)$throwable->getCode(), $throwable);
    }