diff --git a/src/Client/ResponseTrait.php b/src/Client/ResponseTrait.php index f264fa8..5be1ec8 100644 --- a/src/Client/ResponseTrait.php +++ b/src/Client/ResponseTrait.php @@ -28,17 +28,17 @@ protected function handleErrorResponse(string $body, array $headers, int $status case 400: case 405: $returnArray = json_decode($body, true); - throw new ApiSyntaxException($this->getFirstError($returnArray)); + throw new ApiSyntaxException($this->getFirstError($returnArray), $status); case 401: case 403: $returnArray = json_decode($body, true); - throw new ApiAuthenticationException($this->getFirstError($returnArray, 'Invalid credentials')); + throw new ApiAuthenticationException($this->getFirstError($returnArray, 'Invalid credentials'), $status); case 410: case 404: - throw new ApiNotFoundException($url); + throw new ApiNotFoundException($url, $status); default: $returnArray = json_decode($body, true); - throw new ApiGeneralException($this->generalExceptionMessage($returnArray ?? [], $headers)); + throw new ApiGeneralException($this->generalExceptionMessage($returnArray ?? [], $headers), $status); } }