Skip to content

Commit

Permalink
Merge pull request #823 from yaoding16/patch-3
Browse files Browse the repository at this point in the history
Add *protocol.Message For client.ClientErrorFunc
  • Loading branch information
smallnest authored Oct 19, 2023
2 parents 28cad8c + c057e03 commit 6bdc79a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func NewServiceError(s string) ServiceError {
}

// ClientErrorFunc is a function to create a customized error.
var ClientErrorFunc func(e string) ServiceError
var ClientErrorFunc func(res *protocol.Message, e string) ServiceError

type strErr string

Expand Down Expand Up @@ -663,7 +663,7 @@ func (client *Client) input() {

// convert server error to a customized error, which implements ServerError interface
if ClientErrorFunc != nil {
call.Error = ClientErrorFunc(res.Metadata[protocol.ServiceError])
call.Error = ClientErrorFunc(res, res.Metadata[protocol.ServiceError])
} else {
call.Error = strErr(res.Metadata[protocol.ServiceError])
}
Expand Down

0 comments on commit 6bdc79a

Please sign in to comment.