Skip to content

Commit

Permalink
test case confirmed
Browse files Browse the repository at this point in the history
- errors.v3 bug while `errors.Is(err, target)` on a non-conventional target object (for example, `&strconv.NumError{}`)
  • Loading branch information
hedzr committed Oct 15, 2023
1 parent aa57ca9 commit a1bd9e5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions samples/bb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ import (
// TestErrorsIs _
func TestErrorsIs(t *testing.T) {
_, err := strconv.ParseFloat("hello", 64)

t.Logf("err = %+v", err)

e1 := errors2.Unwrap(err)
t.Logf("e1 = %+v", e1)

t.Logf("err = %+v", err)
t.Logf("errors.Is(err, strconv.ErrSyntax): %v", errors.Is(err, strconv.ErrSyntax))
t.Logf("err = %+v", err)
t.Logf("errors.Is(err, &strconv.NumError{}): %v", errors.Is(err, &strconv.NumError{}))
t.Logf("err = %+v", err)

var e2 *strconv.NumError
if errors.As(err, &e2) {
Expand Down

0 comments on commit a1bd9e5

Please sign in to comment.