WrapError wraps the given error with a [SentinelHttpError]. The wrapped error will be displayed in a log, while the [SentinelHttpError] will be sent in the response. return api.WrapError( // This first error will be logged. fmt.Errorf("my action: %w", err), // The HTTP error will be sent
(err error, sentinel SentinelHttpError)
| 62 | // ), |
| 63 | // ) |
| 64 | func WrapError(err error, sentinel SentinelHttpError) error { |
| 65 | return sentinelWrappedError{ |
| 66 | error: err, |
| 67 | sentinel: sentinel, |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | // Interface guards. |
| 72 | var ( |
no outgoing calls