Skip to content

Commit

Permalink
Merge pull request #2 from ORudenkoAS/401-fix
Browse files Browse the repository at this point in the history
Add handling 401 Unauthorized response
  • Loading branch information
ORudenko86 authored Nov 11, 2022
2 parents 7889298 + 1796c47 commit e150da1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ protected function handleResponse(Response $response)
throw new ItemNotFoundException(isset($content->error) ? $content->error : "Error unknown.");
}

if ($response->getStatusCode() == 401) {
throw new PipedriveException(
isset($content->error) ? $content->error : 'Unauthorized',
$response->getStatusCode()
);
}

if ($response->getStatusCode() == 403) {
throw new PipedriveException(
isset($content->error) ? $content->error : 'Forbidden',
Expand Down

0 comments on commit e150da1

Please sign in to comment.