Skip to content

Commit

Permalink
Add error_description to exception message (#57)
Browse files Browse the repository at this point in the history
* Include error_description in exception message
  • Loading branch information
grasmash authored Sep 17, 2024
1 parent 5d3bd66 commit badae8f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Provider/Apple.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,15 @@ protected function getDefaultScopes()
protected function checkResponse(ResponseInterface $response, $data)
{
if ($response->getStatusCode() >= 400) {
$message = $response->getReasonPhrase();
if (array_key_exists('error', $data)) {
$message = $data['error'];
}
if (array_key_exists('error_description', $data)) {
$message .= ': ' . $data['error_description'];
}
throw new AppleAccessDeniedException(
array_key_exists('error', $data) ? $data['error'] : $response->getReasonPhrase(),
$message,
array_key_exists('code', $data) ? $data['code'] : $response->getStatusCode(),
$response
);
Expand Down

0 comments on commit badae8f

Please sign in to comment.