Skip to content

Commit

Permalink
remove unnecessary ErrNoCookie wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
syntaqx committed Jun 30, 2024
1 parent 2e5e2b3 commit 87eca8d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
6 changes: 0 additions & 6 deletions cookie.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ var (
)

var (
// ErrNoCookie is returned when a cookie is not found.
ErrNoCookie = http.ErrNoCookie

// UnsupportedTypeError is returned when a field type is not supported by PopulateFromCookies.
ErrUnsupportedType = errors.New("cookie: unsupported type")

Expand Down Expand Up @@ -169,9 +166,6 @@ func PopulateFromCookies(r *http.Request, dest interface{}) error {
}

if err != nil {
if errors.Is(err, http.ErrNoCookie) {
return ErrNoCookie
}
return err
}

Expand Down
2 changes: 1 addition & 1 deletion cookie_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ func TestPopulateFromCookies_NotFound(t *testing.T) {

dest := &MyStruct{}
err := PopulateFromCookies(r, dest)
if err != ErrNoCookie {
if err != http.ErrNoCookie {
t.Errorf("Expected error ErrNoCookie, got %v", err)
}
}
Expand Down

0 comments on commit 87eca8d

Please sign in to comment.