Skip to content

Commit

Permalink
Wrong errors.Is sample
Browse files Browse the repository at this point in the history
  • Loading branch information
lainio committed Jan 2, 2024
1 parent 5ddb751 commit 74f58ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ notExist := try.Is(r2.err, plugin.ErrNotExist)
**Note.** Any other error than `plugin.ErrNotExist` is treated as an real error:
1. `try.Is` function first checks `if err == nil`, and if yes, it returns
`false`.
2. Then it checks if `errors.Is` == `plugin.ErrNotExist` and if yes, it returns
2. Then it checks if `errors.Is(err, plugin.ErrNotExist)` and if yes, it returns
`true`.
3. Finally, it calls `try.To` for the non nil error, and we already know what then
happens: nearest `err2.Handle` gets it first.
Expand Down

0 comments on commit 74f58ff

Please sign in to comment.