Skip to content

Commit

Permalink
fix: petite correction statusText
Browse files Browse the repository at this point in the history
  • Loading branch information
ocruze committed Nov 23, 2023
1 parent 5fcf994 commit 1dc8d2e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Listener/CartesApiExceptionSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,23 @@ public function onCartesApiException(ExceptionEvent $event): void
}
}

/**
* @SuppressWarnings(UndefinedVariable)
*/
private function getErrorResponse(CartesApiException $throwable): JsonResponse
{
$statusText = 'Internal Server Error';
$responseData = [
'code' => Response::HTTP_INTERNAL_SERVER_ERROR,
'status' => $statusText,
'status' => Response::$statusTexts[Response::HTTP_INTERNAL_SERVER_ERROR],
'message' => 'An internal error has occurred',
'details' => [],
];

if ($throwable instanceof CartesApiException) {
$code = $throwable->getCode();
$responseData['code'] = $code;
$responseData['status'] = $statusText;

$responseData['status'] = Response::$statusTexts[$code];
$responseData['message'] = $throwable->getMessage();
$responseData['details'] = $throwable->getDetails();
}
Expand Down

0 comments on commit 1dc8d2e

Please sign in to comment.