apigee / apigee-client-php

Client library to make API calls to Apigee Edge Management API
Apache License 2.0
27 stars 30 forks source link

Change exceptions used to catch failed GCE authentication #334

Closed mxr576 closed 9 months ago

mxr576 commented 9 months ago

Closes #333

codecov[bot] commented 9 months ago

Codecov Report

Merging #334 (7577a3f) into 3.x (a882b50) will not change coverage. The diff coverage is 0.00%.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/apigee/apigee-client-php/pull/334/graphs/tree.svg?width=650&height=150&src=pr&token=ga5VZb9aAy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee)](https://app.codecov.io/gh/apigee/apigee-client-php/pull/334?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee) ```diff @@ Coverage Diff @@ ## 3.x #334 +/- ## ========================================= Coverage 87.60% 87.60% Complexity 1750 1750 ========================================= Files 349 349 Lines 4704 4704 ========================================= Hits 4121 4121 Misses 583 583 ``` | [Flag](https://app.codecov.io/gh/apigee/apigee-client-php/pull/334/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/apigee/apigee-client-php/pull/334/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee) | `87.60% <0.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/apigee/apigee-client-php/pull/334?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee) | Coverage Δ | | |---|---|---| | [...Client/Plugin/Authentication/GceServiceAccount.php](https://app.codecov.io/gh/apigee/apigee-client-php/pull/334?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apigee#diff-c3JjL0h0dHBDbGllbnQvUGx1Z2luL0F1dGhlbnRpY2F0aW9uL0djZVNlcnZpY2VBY2NvdW50LnBocA==) | `0.00% <0.00%> (ø)` | |
mxr576 commented 9 months ago

Alternative considering, but it feels an overkill to me, catch \Psr\Http\Client\ClientExceptionInterface

Maybe this approach combines best from both worlds, isAvailable() should only fail with NetworkExceptionInterface, when the project is not hosted on GCE -- right? However getAccessToken() can also fail when the service account is not configured properly. so the host was reachable and it returned an HTTP >= 400 code.