Skip to content

Commit

Permalink
fixes exception status forward
Browse files Browse the repository at this point in the history
  • Loading branch information
Elorfin committed Jun 6, 2023
1 parent 1d8f8a9 commit e2d2744
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/main/app/Listener/ApiListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ public function onError(ExceptionEvent $event)
$response = new JsonResponse([
'message' => $exception->getMessage(),
'trace' => $exception->getTrace(),
//if <200, not http error code
], $exception->getCode() < 200 ? 500 : $exception->getCode());
], $exception->getCode() < 100 || $exception->getCode() >= 600 ? 500 : $exception->getCode());

$event->setResponse($response);
}
Expand Down

0 comments on commit e2d2744

Please sign in to comment.