WrapWithHTTPCode adds a HTTP code to an existing error.
(err error, code int)
| 35 | |
| 36 | // WrapWithHTTPCode adds a HTTP code to an existing error. |
| 37 | func WrapWithHTTPCode(err error, code int) error { |
| 38 | if err == nil { |
| 39 | return nil |
| 40 | } |
| 41 | return &withHTTPCode{cause: err, code: code} |
| 42 | } |
| 43 | |
| 44 | // GetHTTPCode retrieves the HTTP code from a stack of causes. |
| 45 | func GetHTTPCode(err error, defaultCode int) int { |