Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign default gRPC status in the first place when the error generated #107

Open
changchingchen opened this issue Jul 10, 2019 · 0 comments

Comments

@changchingchen
Copy link
Contributor

changchingchen commented Jul 10, 2019

For current implementation of function WrapWithSkipAndStatus, if the status is not provided for the first time when the error generated, the status will still remain nil without default value. The default status will be given in the following two situations:

  1. One has generated the error using Orion/utils/errors and then wrap it again. In this case, since the error is originally generated by Orion/utils/errors, the interface interface { GRPCStatus() *Stauts} is then implemented. Thus, the default status will be assigned to a status with gRPC code equals to codes.Internal in the implemented GRPCStatus() *Status function when one wrapping the error again.
  2. One has generated the error using Orion/utils/errors and this error is passed to another gRPC endpoints. In this case, the reason is the same as above situation. When error is passed to another gRPC endpoint, the implemented GRPCStatus() *Status function will be called. Thus, it will then generate a default status with gRPC code equals to codes.Internal.

If the default value of the status will be given in the end, then it should be given in the first place when the error is generated rather than when the error is wrapped again or passed to different gRPC endpoints.

Ref: #106

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant