code.Errorf(msg, args...) builds a new Twirp error with code and formatted msg. The format may include "%w" to wrap other errors. Examples: twirp.Internal.Error("Oops: %w", originalErr) twirp.NotFound.Error("Resource not found with id: %q", resourceID)
(msgFmt string, a ...interface{})
| 85 | // twirp.Internal.Error("Oops: %w", originalErr) |
| 86 | // twirp.NotFound.Error("Resource not found with id: %q", resourceID) |
| 87 | func (code ErrorCode) Errorf(msgFmt string, a ...interface{}) Error { |
| 88 | return NewErrorf(code, msgFmt, a...) |
| 89 | } |
| 90 | |
| 91 | // WrapError allows Twirp errors to wrap other errors. |
| 92 | // The wrapped error can be extracted later with (github.com/pkg/errors).Unwrap |