diff --git a/src/HttpClient/Plugin/Authentication/GceServiceAccount.php b/src/HttpClient/Plugin/Authentication/GceServiceAccount.php index f23c9044..f932067d 100644 --- a/src/HttpClient/Plugin/Authentication/GceServiceAccount.php +++ b/src/HttpClient/Plugin/Authentication/GceServiceAccount.php @@ -21,8 +21,9 @@ use Apigee\Edge\Client; use Apigee\Edge\ClientInterface; use Apigee\Edge\Exception\ApigeeOnGcpOauth2AuthenticationException; -use Http\Client\Exception; use Http\Message\Authentication\Header; +use Psr\Http\Client\ClientExceptionInterface; +use Psr\Http\Client\NetworkExceptionInterface; /** * GCE Service Account authentication plugin for authenticating to Google @@ -61,7 +62,7 @@ public function isAvailable(): bool $this->authClient()->get(''); return true; - } catch (Exception $e) { + } catch (NetworkExceptionInterface $e) { return false; } } @@ -85,7 +86,7 @@ protected function getAccessToken(): void $response = $this->authClient()->get(''); $decoded_token = json_decode((string) $response->getBody(), true); $this->tokenStorage->saveToken($decoded_token); - } catch (Exception $e) { + } catch (ClientExceptionInterface $e) { throw new ApigeeOnGcpOauth2AuthenticationException($e->getMessage(), $e->getCode(), $e); } }