ErrorContext returns the context map for an error if it is a wrappedError. If it is not a wrappedError it will return an empty map.
(err error)
| 35 | // ErrorContext returns the context map for an error if it is a wrappedError. |
| 36 | // If it is not a wrappedError it will return an empty map. |
| 37 | func Context(err error) map[string]interface{} { |
| 38 | if e, ok := err.(withContext); ok { |
| 39 | return e.Context() |
| 40 | } |
| 41 | return nil |
| 42 | } |