WithDetailf is like WithDetail, except it formats the detail message as in fmt.Printf. Function Detail will return the formatted text when called on the new error value.
(err error, format string, v ...interface{})
| 100 | // Function Detail will return the formatted text |
| 101 | // when called on the new error value. |
| 102 | func WithDetailf(err error, format string, v ...interface{}) error { |
| 103 | if err == nil { |
| 104 | return nil |
| 105 | } |
| 106 | text := fmt.Sprintf(format, v...) |
| 107 | e1 := wrap(err, text, 1).(wrapperError) |
| 108 | e1.detail = append(e1.detail, text) |
| 109 | return e1 |
| 110 | } |
| 111 | |
| 112 | // Detail returns the detail message contained in err, if any. |
| 113 | // An error has a detail message if it was made by WithDetail |