-
Notifications
You must be signed in to change notification settings - Fork 1
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
gRPC Error Wrapper #7
Comments
自分で https://github.com/grpc/grpc-go/blob/9519efffeb5d1897ae8671568871a6d476986524/status/status.go#L83-L85 に合致するinterfaceを作ってしまうという手もあるらしい
|
errors.As() をサポートするissueはあるけど、まだ作られてはいない |
sinmetal
added a commit
that referenced
this issue
Oct 23, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
WHAT
gRPCのerrorをいい感じにWrapする方法を考える。
選択肢的には以下のどちらか。
どっちもどっちみたいな気持ち
fmt.Errorf(": %w" err) でwrapしたものを剥いて、status.Status を取り出す
以下のようなやつ
https://github.com/sinmetal/til/blob/51fd3cc40761e95b77dee6168be5d436d7cc1f7e/datastore/tx/cloud_datastore_service.go#L45
status.Status を内包する Custom Error を作る
WHY
gRPC の error は Wrap すると、gRPC package の関数では取り出せない
The text was updated successfully, but these errors were encountered: