TUN-3107: UnregisterConnection shouldn't wrap nil error as RPC error

This commit is contained in:
cthuang 2020-06-18 21:17:43 +08:00
parent 4d3ebaf984
commit 3886021ba5
2 changed files with 10 additions and 4 deletions

View File

@ -229,5 +229,8 @@ func (c TunnelServer_PogsClient) Unregister(ctx context.Context) error {
return nil return nil
}) })
_, err := promise.Struct() _, err := promise.Struct()
return wrapRPCError(err) if err != nil {
return wrapRPCError(err)
}
return nil
} }

View File

@ -37,9 +37,12 @@ func (re *RPCError) Error() string {
} }
func wrapRPCError(err error) *RPCError { func wrapRPCError(err error) *RPCError {
return &RPCError{ if err != nil {
err: err, return &RPCError{
err: err,
}
} }
return nil
} }
func newRPCError(format string, args ...interface{}) *RPCError { func newRPCError(format string, args ...interface{}) *RPCError {
@ -50,4 +53,4 @@ func newRPCError(format string, args ...interface{}) *RPCError {
func (re *RPCError) Unwrap() error { func (re *RPCError) Unwrap() error {
return re.err return re.err
} }