errwithstatus

This commit is contained in:
2024-02-06 13:39:11 +09:00
parent 163f52a5c1
commit ce86e0bf72

View File

@ -576,7 +576,11 @@ func (rt *RpcReturnError) WithCode(code int) *RpcReturnError {
}
func (rt *RpcReturnError) WithError(err error) *RpcReturnError {
rt.err = err
if err2, ok := err.(*ErrorWithStatus); ok {
rt.WithCode(err2.StatusCode)
} else {
rt.err = err
}
return rt
}