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

[Ftr]: support return exception #30

Merged

Conversation

wolingzong
Copy link
Contributor

What this PR does:
triple-go exception return support

Which issue(s) this PR fixes:

Fixes #
triple-go exception return support

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


@AlexStocks AlexStocks changed the title triple-go 异常回传支持 [Ftr]: support return exception Sep 12, 2021
@LaurenceLiZhixin
Copy link
Contributor

感谢提交PR。
修改的地方,方向是正确的,将回传的status解析了出来。但客户端解析只是异常回传的一个环节。在provider 端:internal/stream/processor.go:66 handleRPCErr这个位置,需要将用户或者框架抛出来的error,放入status内。目前只有Message信息和Code信息。
参考internal/status/status.go:38 Status 结构的一系列构造方法,都没有detail字段的实现。
因此来自用户/框架的error内的堆栈信息都无法转换成status,从而回传。这也是要做的最关键的工作。
使用perrors.New() 或者 perrors.Errorf() 构造出来的error 都带有堆栈信息,可以使用 fmt.Sprintf("%+v", err)方法获取。放入status结构内。

@wolingzong
Copy link
Contributor Author

grpc-status-details-bin添加好了

@@ -22,6 +22,7 @@ import (
"context"
"errors"
"fmt"
spb "google.golang.org/genproto/googleapis/rpc/status"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move it to the 2rd import block.

@LaurenceLiZhixin LaurenceLiZhixin merged commit 6a249c0 into dubbogo:master Oct 11, 2021
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

Successfully merging this pull request may close these issues.

3 participants