Is detects whether the error is equal to a given error. Errors are considered equal by this function if they are matched by errors.Is or if their contained errors are matched through errors.Is.
(e error, original error)
| 19 | // are considered equal by this function if they are matched by errors.Is |
| 20 | // or if their contained errors are matched through errors.Is. |
| 21 | func Is(e error, original error) bool { |
| 22 | if baseErrors.Is(e, original) { |
| 23 | return true |
| 24 | } |
| 25 | |
| 26 | if e, ok := e.(*Error); ok { |
| 27 | return Is(e.Err, original) |
| 28 | } |
| 29 | |
| 30 | if original, ok := original.(*Error); ok { |
| 31 | return Is(e, original.Err) |
| 32 | } |
| 33 | |
| 34 | return false |
| 35 | } |