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

More logs #29

Merged
merged 11 commits into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: fmt
  • Loading branch information
LaurenceLiZhixin committed Sep 4, 2021
commit 471bc9402dd8bf2f02c35014edfb845e724152dd
4 changes: 1 addition & 3 deletions example/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@ require (
google.golang.org/grpc v1.38.0
)

replace github.com/dubbogo/triple => ../

replace dubbo.apache.org/dubbo-go/v3 => ../../dubbo-go
replace github.com/dubbogo/triple => ../
12 changes: 6 additions & 6 deletions pkg/triple/dubbo3_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func NewTripleClient(impl interface{}, opt *config.Option) (*TripleClient, error
}

// Invoke call remote using stub
func (t *TripleClient) Invoke(methodName string, in []reflect.Value, reply interface{}) (common.TripleAttachment, error) {
func (t *TripleClient) Invoke(methodName string, in []reflect.Value, reply interface{}) common.ErrorWithAttachment {
attachment := make(common.TripleAttachment)
var err error

Expand All @@ -86,12 +86,12 @@ func (t *TripleClient) Invoke(methodName string, in []reflect.Value, reply inter
errWithAtta, ok := res[1].Interface().(*common.ErrorWithAttachment)
if ok {
if errWithAtta.GetError() != nil {
return attachment, errWithAtta.GetError()
return *common.NewErrorWithAttachment(errWithAtta.GetError(), attachment)
}
attachment = errWithAtta.GetAttachments()
// 兼容性处理,针对未更新的stub
} else if res[1].IsValid() && res[1].Interface() != nil {
return attachment, res[1].Interface().(error)
// compatible with not updated triple stub
return *common.NewErrorWithAttachment(res[1].Interface().(error), attachment)
}
_ = tools.ReflectResponse(res[0], reply)
} else {
Expand All @@ -105,10 +105,10 @@ func (t *TripleClient) Invoke(methodName string, in []reflect.Value, reply inter
}
attachment, err = t.Request(ctx, "/"+interfaceKey+"/"+methodName, reqParams, reply)
if err != nil {
return attachment, err
return *common.NewErrorWithAttachment(err, attachment)
}
}
return attachment, nil
return *common.NewErrorWithAttachment(nil, attachment)
}

// Request call h2Controller to send unary rpc req to server
Expand Down