Skip to content

Commit

Permalink
feat: make sure to use response status message & code in exception wh…
Browse files Browse the repository at this point in the history
…enever available
  • Loading branch information
kauffinger committed Oct 15, 2024
1 parent 3654e3c commit d5bd46a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Services/OnOfficeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ public function throwIfResponseIsFailed(Response $response): void
}

match (true) {
$statusCode >= 300 && $statusErrorCode > 0 => throw new OnOfficeException($errorMessage, $statusErrorCode, isResponseError: true),
$statusCode >= 300 && $statusErrorCode <= 0 => throw new OnOfficeException($errorMessage, $statusCode),
$statusCode >= 300 && $statusErrorCode > 0 && $responseStatusCode === 0 => throw new OnOfficeException($errorMessage, $statusErrorCode, isResponseError: true),
$statusCode >= 300 && $statusErrorCode <= 0 && $responseStatusCode === 0 => throw new OnOfficeException($errorMessage, $statusCode),
$responseStatusCode > 0 => throw new OnOfficeException($responseErrorMessage, $responseStatusCode, isResponseError: true),
default => null,
};
Expand Down

0 comments on commit d5bd46a

Please sign in to comment.