Skip to content

Commit

Permalink
Update website.com exception handler to return a formatted error resp…
Browse files Browse the repository at this point in the history
…onse for connection exceptions
  • Loading branch information
uphlewis committed Aug 19, 2024
1 parent d4c1da9 commit da0d55b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Providers/Websitecom/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Exception\TransferException;
use GuzzleHttp\RequestOptions;
use Illuminate\Support\Str;
use Throwable;
Expand Down Expand Up @@ -162,6 +163,14 @@ protected function handleException(\Throwable $e, $params = null): void
}
}

if ($e instanceof TransferException) {
throw $this->errorResult('Provider API Connection Failed', [
'exception' => get_class($e),
'code' => $e->getCode(),
'message' => $e->getMessage(),
], [], $e);
}

throw $e;
}

Expand Down

0 comments on commit da0d55b

Please sign in to comment.