ErrorSetContext sets a value in the error's context. If the error has not been wrapped, it does nothing.
(err error, key string, value interface{})
| 10 | // ErrorSetContext sets a value in the error's context. If the error has not |
| 11 | // been wrapped, it does nothing. |
| 12 | func SetContext(err error, key string, value interface{}) { |
| 13 | if e, ok := err.(withContext); ok { |
| 14 | e.Set(key, value) |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | // ErrorGetContext gets a value from the error's context. If the error has not |
| 19 | // been wrapped, it returns an empty string. |