mirror of
https://github.com/duanhf2012/origin.git
synced 2026-05-17 22:54:49 +08:00
优化error空值返回
This commit is contained in:
@@ -16,14 +16,14 @@ type FuncRpcServer func() (*Server)
|
||||
var NilError = reflect.Zero(reflect.TypeOf((*error)(nil)).Elem())
|
||||
|
||||
type RpcError string
|
||||
|
||||
var noError RpcError
|
||||
func (e RpcError) Error() string {
|
||||
return string(e)
|
||||
}
|
||||
|
||||
func ConvertError(e error) RpcError{
|
||||
if e == nil {
|
||||
return ""
|
||||
return noError
|
||||
}
|
||||
|
||||
rpcErr := RpcError(e.Error())
|
||||
|
||||
Reference in New Issue
Block a user