自定义rpc错误类型

This commit is contained in:
duanhf2012
2020-04-01 13:42:09 +08:00
parent b953d8dfbb
commit 89d41d60fa
4 changed files with 50 additions and 14 deletions

View File

@@ -130,7 +130,7 @@ func (slf *Client) Go(noReply bool,mutiCoroutine bool,serviceMethod string, args
return call
}
type RequestHandler func(Returns interface{},Err error)
type RequestHandler func(Returns interface{},Err *RpcError)
type RpcRequest struct {
//packhead
@@ -151,7 +151,7 @@ type RpcRequest struct {
type RpcResponse struct {
//head
Seq uint64 // sequence number chosen by client
Err error
Err *RpcError
//returns
Returns []byte
@@ -189,6 +189,9 @@ func (slf *Client) Run(){
v.Err = err
}
}
if respone.Err != nil {
v.Err= respone.Err
}
if v.callback.IsValid() {