Uh oh!
There was an error while loading. Please reload this page.
Support individual API exception types - #357
Conversation
Codecov Report
@@ Coverage Diff @@## master #357 +/- ##
=========================================
Coverage 76.63% 76.63% Complexity 495 495 =========================================
Files 114 114 Lines 2542 2542 Branches 185 185 =========================================
Hits 1948 1948 Misses 522 522 Partials 72 72Continue to review full report at Codecov.
|
| if (statusCode != null) { | ||
| assertThat(exception.getCause()).isInstanceOf(GrpcApiException.class); | ||
| GrpcApiException cause = (GrpcApiException) exception.getCause(); | ||
| assertThat(exception.getCause() instanceof ApiException); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| import com.google.api.gax.rpc.ResourceExhaustedApiException; | ||
| import com.google.api.gax.rpc.UnauthenticatedApiException; | ||
| import com.google.api.gax.rpc.UnavailableApiException; | ||
| import com.google.api.gax.rpc.UnknownApiException; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| import com.google.api.core.BetaApi; | ||
| /** Represents an aborted exception thrown during an RPC call. */ |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
shinfan
commented
Aug 24, 2017
@garrettjonesgoogle PTAL |
garrettjonesgoogle
left a comment
There was a problem hiding this comment.
LGTM after my one comment is addressed here.
I'd also like @jabubake to take a look.
| return new GrpcDirectCallable<>(FakeMethodDescriptor.<Integer, Operation>create()); | ||
| } | ||
| private void assertExceptionType(GrpcStatusCode code, Throwable exception) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
jabubake
commented
Aug 24, 2017
LGTM, this is great. |
c0f7d58 to
d69b3c8Compare
We were wrapping all underlying API exceptions as a transport-agnostic ApiException which makes it hard to catch based on the status code.
To improve the try/catch experience, we now add an individual exception class for each status code.