php-ze-ph.InternalServerError.php.mustache Maven / Gradle / Ivy
responseGenerator = $responseGenerator;
}
/**
* @inheritdoc
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$result = null;
try {
ErrorHandler::start();
$result = $handler->handle($request);
ErrorHandler::stop(true);
}
catch (\Throwable $error) {
$result = $this->handleError($error);
}
return $result;
}
public function handleError(\Throwable $error): ResponseInterface
{
\error_log((string)$error);
return $this->generateEmptyResponse()->withStatus(500, 'Internal server error');
}
protected function generateEmptyResponse(): ResponseInterface
{
return ($this->responseGenerator)();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy