fix: use Is to check err values

This commit is contained in:
Artur Mechetin 2024-12-31 18:23:37 +03:00 committed by GitHub
parent 8e08283bee
commit d6a720b95e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1178,7 +1178,7 @@ When handling an error, we can decide to wrap it. Wrapping is about adding addit
???+ info "TL;DR"
If you use Go 1.13 error wrapping with the `%w` directive and `fmt.Errorf`, comparing an error against or a value has to be done using `errors.As`. Otherwise, if the returned error you want to check is wrapped, it will fail the checks.
If you use Go 1.13 error wrapping with the `%w` directive and `fmt.Errorf`, comparing an error against or a value has to be done using `errors.Is`. Otherwise, if the returned error you want to check is wrapped, it will fail the checks.
A sentinel error is an error defined as a global variable: