You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Without DescriptionthrownewGrpcStatusException(GrpcStatusCode.PERMISSION_DENIED.status());
// With DescriptionthrownewGrpcStatusException(newGrpcStatus(GrpcStatusCode.PERMISSION_DENIED, "my-description"));
Other GRPC implementations provide convenience methods like:
…hods.
Motivation:
In reference to issue apple#2502, there should be a more convenient way to initialize GRPC Exceptions analogous to other GRPC implementations.
Modifications:
- Removed the deprecation from GrpcStatus.asException as it is required for this implementation of desired functionality.
- Added additional constructor for GrpcStatus to support initialization from codeValue and description.
- Added convenience method GrpcStatusCode.withDescription to support desired functionality.
- Added GrpcStatusTest.testGrpcStatusExceptionFromGrpcStatusCode for test-driven development and better test coverage.
Result:
GRPC Exceptions can now be initialized and thrown more conveniently.
What is the result of this change?
I had a go at this issue as my first contribution to ServiceTalk, I hope you don't mind.
Let me know if there is anything you would like me to change or discuss.
At the moment, a GRPC exception can be created as
Other GRPC implementations provide convenience methods like:
We could potentially add something similar to streamline exception generation (also including
withCause
, etc).The text was updated successfully, but these errors were encountered: