From c3a55462bd34839380cada8da46304aa4cfab26d Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Sat, 26 Oct 2019 19:27:58 +0300 Subject: [PATCH] fix sessions.ErrNotFound.Equal example Former-commit-id: 292eadaea9df1c680e68a3f92f86c8bf1edc2d7d --- _examples/sessions/database/badger/main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/_examples/sessions/database/badger/main.go b/_examples/sessions/database/badger/main.go index 8489c1860..bb8a7c08f 100644 --- a/_examples/sessions/database/badger/main.go +++ b/_examples/sessions/database/badger/main.go @@ -1,6 +1,7 @@ package main import ( + "errors" "time" "github.com/kataras/iris/v12" @@ -90,9 +91,9 @@ func main() { app.Get("/update", func(ctx iris.Context) { // updates resets the expiration based on the session's `Expires` field. if err := sess.ShiftExpiration(ctx); err != nil { - if sessions.ErrNotFound.Equal(err) { + if errors.Is(err, sessions.ErrNotFound) { ctx.StatusCode(iris.StatusNotFound) - } else if sessions.ErrNotImplemented.Equal(err) { + } else if errors.Is(err, sessions.ErrNotImplemented) { ctx.StatusCode(iris.StatusNotImplemented) } else { ctx.StatusCode(iris.StatusNotModified)