withData returns a new error that wraps err as a chain error message containing v as an extra data item. Calling Data on the returned error yields v. Note that if err already has a data item, it will not be accessible via the returned error value.
(err error, v map[string]interface{})
| 124 | // Note that if err already has a data item, |
| 125 | // it will not be accessible via the returned error value. |
| 126 | func withData(err error, v map[string]interface{}) error { |
| 127 | if err == nil { |
| 128 | return nil |
| 129 | } |
| 130 | e1 := wrap(err, "", 1).(wrapperError) |
| 131 | e1.data = v |
| 132 | return e1 |
| 133 | } |
| 134 | |
| 135 | // WithData returns a new error that wraps err |
| 136 | // as a chain error message containing a value of type |