diff --git a/http-server/ExceptionHandlerDispatcher.php b/http-server/ExceptionHandlerDispatcher.php index b858a842..3a1e466d 100644 --- a/http-server/ExceptionHandlerDispatcher.php +++ b/http-server/ExceptionHandlerDispatcher.php @@ -4,9 +4,11 @@ namespace Server; use Server\Constrict\Response; -use Server\Constrict\Response as CResponse; -use Server\Message\Stream; +use Protocol\Message\Response as CResponse; use Throwable; +use Protocol\Message\Stream; +use Server\Constrict\ResponseInterface; + /** * @@ -17,20 +19,19 @@ class ExceptionHandlerDispatcher implements ExceptionHandlerInterface /** * @param Throwable $exception - * @param CResponse $response + * @param Response $response * @return ResponseInterface - * @throws \Exception */ public function emit(Throwable $exception, Response $response): ResponseInterface { if ($exception->getCode() == 404) { return $response->withBody(new Stream($exception->getMessage())) - ->withContentType(Message\Response::CONTENT_TYPE_HTML) + ->withContentType(CResponse::CONTENT_TYPE_HTML) ->withStatus(404); } $code = $exception->getCode() == 0 ? 500 : $exception->getCode(); return $response->withBody(new Stream(jTraceEx($exception, null, true))) - ->withContentType(Message\Response::CONTENT_TYPE_HTML) + ->withContentType(CResponse::CONTENT_TYPE_HTML) ->withStatus($code); } diff --git a/http-server/ExceptionHandlerInterface.php b/http-server/ExceptionHandlerInterface.php index c4f7409b..3ce7f55c 100644 --- a/http-server/ExceptionHandlerInterface.php +++ b/http-server/ExceptionHandlerInterface.php @@ -4,6 +4,7 @@ namespace Server; use Server\Constrict\Response; use Throwable; +use Server\Constrict\ResponseInterface; /** *