Is reports whether target is an *Error with the same type and message, enabling matching with errors.Is against sentinel errors.
(target error)
| 73 | // Is reports whether target is an *Error with the same type and message, |
| 74 | // enabling matching with errors.Is against sentinel errors. |
| 75 | func (e *Error) Is(target error) bool { |
| 76 | var t *Error |
| 77 | if !errors.As(target, &t) { |
| 78 | return false |
| 79 | } |
| 80 | return e.ErrorType == t.ErrorType && e.Message == t.Message |
| 81 | } |
| 82 | |
| 83 | // Errorf returns Error(ErrorType, fmt.Sprintf(format, a...)). |
| 84 | func Errorf(errorType Type, format string, a ...interface{}) error { |
no outgoing calls