Skip to content

Commit

Permalink
Codeception
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrenkoAnton committed Feb 12, 2024
1 parent 60b4b3d commit ddacd2f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ class Handler extends ExceptionHandler
// phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingAnyTypeHint
public function render($request, Throwable $exception): JsonResponse
{
// $rendered = parent::render($request, $exception);
$rendered = parent::render($request, $exception);

return new JsonResponse(
['error' => $exception->getMessage().' '. get_class($exception) .' '. $exception->getTraceAsString()],
499,
['error' => $rendered->getContent()
? json_decode($rendered->getContent())
: $exception->getMessage()
],
$rendered->getStatusCode(),
);
}
}

0 comments on commit ddacd2f

Please sign in to comment.