MCPcopy Index your code
hub / github.com/go-errors/errors / Is

Function Is

error_1_13.go:21–35  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
21func 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}

Callers 3

TestIs113Function · 0.70
TestIsFunction · 0.70
ExampleIsFunction · 0.70

Calls 1

IsMethod · 0.80

Tested by 3

TestIs113Function · 0.56
TestIsFunction · 0.56
ExampleIsFunction · 0.56