New returns an error representing code and msg. If code is OK, returns nil.
(code codes.Code, msg string)
| 28 | |
| 29 | // New returns an error representing code and msg. If code is OK, returns nil. |
| 30 | func New(code codes.Code, msg string) *Error { |
| 31 | if code == codes.OK { |
| 32 | return nil |
| 33 | } |
| 34 | return &Error{ |
| 35 | msg: msg, |
| 36 | code: code, |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | // Newf returns New(code, fmt.Sprintf(format, args...)). |
| 41 | func Newf(code codes.Code, format string, args ...interface{}) *Error { |
no outgoing calls