WithMessage wraps any of the errors listed above. For examples, see errors/errors.md.
(e error, msg string)
| 44 | // WithMessage wraps any of the errors listed above. |
| 45 | // For examples, see errors/errors.md. |
| 46 | func WithMessage(e error, msg string) error { |
| 47 | // Note: Errorf automatically wraps the error when used with `%w`. |
| 48 | if len(msg) > 0 { |
| 49 | return fmt.Errorf("%w: %v", e, msg) |
| 50 | } |
| 51 | // We still need to use %w to prevent callers from using e == ErrInvalidDockerFile. |
| 52 | return fmt.Errorf("%w", e) |
| 53 | } |
| 54 | |
| 55 | // GetName returns the name of the error. |
| 56 | func GetName(err error) string { |
no outgoing calls