Skip to content

Commit

Permalink
Merge pull request #18 from DrH97/dev-dr
Browse files Browse the repository at this point in the history
adds log for tanda request failure
  • Loading branch information
DrH97 authored Feb 5, 2022
2 parents e91718a + a3af6bf commit 568c8e7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Library/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use DrH\Tanda\Exceptions\TandaException;
use DrH\Tanda\Models\TandaRequest;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
use Psr\Http\Message\ResponseInterface;

Expand Down Expand Up @@ -37,6 +38,7 @@ public function request(string $endpointSuffix, array $body, array $replace = []
$_body = json_decode($response->getBody());

if (!str_starts_with($response->getStatusCode(), "2")) {
Log::error((array)$_body ?? $response->getBody());
throw new TandaException($_body->message ?
$_body->status . ' - ' . $_body->message : $response->getBody());
}
Expand Down
1 change: 0 additions & 1 deletion tests/Models/TandaRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,5 @@ function a_request_has_unique_request_id()
} catch (QueryException $e) {
$this->assertStringContainsString("UNIQUE constraint failed", $e->getMessage());
}

}
}

0 comments on commit 568c8e7

Please sign in to comment.