Skip to content

Commit

Permalink
Allow exceptions to be thrown when token renew fails
Browse files Browse the repository at this point in the history
Bad order of operations was preventing errors from being detected.
  • Loading branch information
shadowhand committed Mar 6, 2015
1 parent 814aff6 commit fa1d609
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Provider/Square.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,14 @@ public function getAccessToken($grant = 'authorization_code', $params = [])
// @codeCoverageIgnoreEnd
}

$result = json_decode($response, true);

if (isset($result['error']) && ! empty($result['error'])) {
// @codeCoverageIgnoreStart
throw new IDPException($result);
// @codeCoverageIgnoreEnd
}

$result = json_decode($response, true);
$result = $this->prepareAccessTokenResult($result);

return $grant->handleResponse($result);
Expand Down

0 comments on commit fa1d609

Please sign in to comment.