request = $request; try { $response = $handler->handle($request); } catch (\Throwable $ex) { $this->pushData($ex); if ( $this->callback ?? false ) { return call_user_func_array($this->callback, [ $ex, $request ] ); } else { throw $ex; } } return $response ?? new HtmlResponse("..."); } public function handleException(\Throwable $ex) : array { $server = isset($this->request) ? $this->request->getServerParams() : $_SERVER; $body = isset($this->request) ? $this->request->getParsedBody() : $_POST; return $this->exceptionHandler->extractExceptionData($ex, $server, $body); } }