isDevelopmentMode = $isDevelopmentMode; } /** * Create/update the response representing the error. */ public function __invoke( Throwable $e, ServerRequestInterface $request, ResponseInterface $response ): ResponseInterface { $response = $response->withStatus(Utils::getStatusCode($e, $response)); $body = $response->getBody(); if ($this->isDevelopmentMode) { $escaper = new Escaper(); $body->write($escaper->escapeHtml((string) $e)); return $response; } $body->write($response->getReasonPhrase() ?: 'Unknown Error'); return $response; } }