Skip to content

Commit

Permalink
chore: add basic information to UnexpectedResponseData [SPMVP-7367]
Browse files Browse the repository at this point in the history
  • Loading branch information
bepsvpt committed May 10, 2024
1 parent 9d7dd8b commit 0405e78
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Requests/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ protected function request(
->{$method}($this->url($path), $options);

if (! ($response instanceof Response)) {
throw new UnexpectedResponseData();
throw new UnexpectedResponseData(get_class($response) ?: gettype($response));
}

$data = $response->object();

if ($isArray) {
if (! is_array($data)) { // @phpstan-ignore-line
throw new UnexpectedResponseData();
throw new UnexpectedResponseData($response->body());
}
} elseif (! ($data instanceof stdClass)) {
throw new UnexpectedResponseData();
throw new UnexpectedResponseData($response->body());
}

if (! $response->successful() || ! $response->json('ok', true)) {
Expand Down

0 comments on commit 0405e78

Please sign in to comment.