Skip to content

Commit

Permalink
examples: minor
Browse files Browse the repository at this point in the history
  • Loading branch information
kataras committed Oct 27, 2019
1 parent d7c64d6 commit 200e0dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions _examples/sessions/database/boltdb/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"errors"
"os"
"time"

Expand Down Expand Up @@ -91,9 +92,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
5 changes: 3 additions & 2 deletions _examples/sessions/database/redis/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 @@ -127,9 +128,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 200e0dd

Please sign in to comment.