Skip to content

Commit

Permalink
fix sessions.ErrNotFound.Equal example
Browse files Browse the repository at this point in the history
Former-commit-id: 292eadaea9df1c680e68a3f92f86c8bf1edc2d7d
  • Loading branch information
kataras committed Oct 26, 2019
1 parent 1c79193 commit c3a5546
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions _examples/sessions/database/badger/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"errors"
"time"

"github.com/kataras/iris/v12"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c3a5546

Please sign in to comment.