fr
fr

Question from the Go test

Medium

What is the exact behavior of errors.Is(err, ErrNotFound) in this example, considering that ErrNotFound is wrapped?

var ErrNotFound = errors.New("not found")

func find() error {
	return fmt.Errorf("db error: %w", ErrNotFound)
}

func main() {
	err := find()
	// Quel comportement pour cette vérification ?
	fmt.Println(errors.Is(err, ErrNotFound))
}
Author: WeLoveDevsStatus: PublishedQuestion not yet passed
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!