Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #9 from b3-it/fix_ErrorHandler
Browse files Browse the repository at this point in the history
* Fix $errorBody['code'] not set on invalid credentials
  • Loading branch information
JohannesFerner authored Apr 29, 2021
2 parents 0ce74b6 + c220300 commit 315b4cb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/errors/FiskalyErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ public static function throwOnError($response)
$errorBody = json_decode(base64_decode($responseData['response']['body']), true);
$requestId = $responseData['response']['headers']['x-request-id'][0];

if (!isset($errorBody['code'])) {
$errorBody['code'] = '';
}

throw new FiskalyHttpException($errorBody['message'], $errorBody['code'], $errorBody['error'], $errorBody['status_code'], $requestId);
} elseif ($response->getCode() == self::$HTTP_TIMEOUT_ERROR) {
throw new FiskalyHttpTimeoutException($response->getMessage());
Expand Down

0 comments on commit 315b4cb

Please sign in to comment.