This commit is contained in:
2023-04-24 11:09:28 +08:00
parent 1b3913e60f
commit 48c925cbcf
2 changed files with 2 additions and 2 deletions
+2
View File
@@ -22,9 +22,11 @@ class ExceptionHandlerDispatcher implements ExceptionHandlerInterface
* @param Throwable $exception * @param Throwable $exception
* @param object $response * @param object $response
* @return ResponseInterface * @return ResponseInterface
* @throws
*/ */
public function emit(Throwable $exception, object $response): ResponseInterface public function emit(Throwable $exception, object $response): ResponseInterface
{ {
error($exception);
$response->withContentType(ContentType::HTML)->withBody(new Stream(jTraceEx($exception, null, true))); $response->withContentType(ContentType::HTML)->withBody(new Stream(jTraceEx($exception, null, true)));
if ($exception->getCode() == 404) { if ($exception->getCode() == 404) {
return $response->withStatus(404); return $response->withStatus(404);
-2
View File
@@ -86,10 +86,8 @@ class ServerRequest
$PsrResponse = (new HttpRequestHandler($middleware, $dispatcher))->handle($request); $PsrResponse = (new HttpRequestHandler($middleware, $dispatcher))->handle($request);
} catch (\Throwable $throwable) { } catch (\Throwable $throwable) {
error($throwable);
$PsrResponse = $this->exception->emit($throwable, di(ConstrictResponse::class)); $PsrResponse = $this->exception->emit($throwable, di(ConstrictResponse::class));
} finally { } finally {
var_dump($this->emitter, $PsrResponse, $response);
$this->emitter->sender($PsrResponse, $response); $this->emitter->sender($PsrResponse, $response);
} }
} }