Skip to content

Commit

Permalink
guzzle check response existance
Browse files Browse the repository at this point in the history
  • Loading branch information
Хапачев Магамет committed Feb 3, 2023
1 parent 6f6248c commit 5928e6f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Libs/BaseService.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function request($url, array $data = [], string $method = 'get'): string|
} catch (RequestException $e) {
$this->errorMessage = urldecode($e->getMessage());
$this->errorCode = $e->getCode();
if ($e->getResponse()->getStatusCode() == 400)
if ($e->hasResponse() && $e->getResponse()?->getStatusCode() == 400)
$this->errorMessage = urldecode($e->getResponse()->getBody()->getContents());
} catch (Exception $e) {
$this->errorCode = $e->getCode();
Expand Down

0 comments on commit 5928e6f

Please sign in to comment.