Skip to content

Commit

Permalink
Add LowAuthorization exception
Browse files Browse the repository at this point in the history
  • Loading branch information
h4kuna committed Sep 26, 2023
1 parent cc9cfab commit 5dddb7a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/Exceptions/LowAuthorization.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php declare(strict_types=1);

namespace h4kuna\Fio\Exceptions;

final class LowAuthorization extends ServiceUnavailable
{

}
2 changes: 1 addition & 1 deletion src/Exceptions/ServiceUnavailable.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace h4kuna\Fio\Exceptions;

final class ServiceUnavailable extends \RuntimeException
class ServiceUnavailable extends \RuntimeException
{

}
4 changes: 4 additions & 0 deletions src/Read/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ public function create(ResponseInterface $response): TransactionList
{
$content = $response->getBody()->getContents();

if ($response->getStatusCode() === 422) {
throw new Exceptions\LowAuthorization($content, $response->getStatusCode());
}

if ($content === '') {
$content = '{}';
}
Expand Down

0 comments on commit 5dddb7a

Please sign in to comment.