************************************/ ********* ERROR MANAGEMENT *********/ ************************************/ Error attaches an error to the current context. The error is pushed to a list of errors. It's a good idea to call Error for each error that occurred during the resolution of a request. A
(err error)
| 250 | // print a log, or append it in the HTTP response. |
| 251 | // Error will panic if err is nil. |
| 252 | func (c *Context) Error(err error) *Error { |
| 253 | if err == nil { |
| 254 | panic("err is nil") |
| 255 | } |
| 256 | |
| 257 | var parsedError *Error |
| 258 | ok := errors.As(err, &parsedError) |
| 259 | if !ok { |
| 260 | parsedError = &Error{ |
| 261 | Err: err, |
| 262 | Type: ErrorTypePrivate, |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | c.Errors = append(c.Errors, parsedError) |
| 267 | return parsedError |
| 268 | } |
| 269 | |
| 270 | /************************************/ |
| 271 | /******** METADATA MANAGEMENT********/ |
no outgoing calls
no test coverage detected