diff --git a/examples/with-labstack-echo/main.go b/examples/with-labstack-echo/main.go index a080f934..ed9c5c42 100644 --- a/examples/with-labstack-echo/main.go +++ b/examples/with-labstack-echo/main.go @@ -3,10 +3,11 @@ package main import ( "encoding/json" "errors" - "github.com/supertokens/supertokens-golang/recipe/dashboard" "net/http" "strings" + "github.com/supertokens/supertokens-golang/recipe/dashboard" + "github.com/labstack/echo/v4" "github.com/supertokens/supertokens-golang/recipe/emailverification" "github.com/supertokens/supertokens-golang/recipe/emailverification/evmodels" @@ -200,8 +201,14 @@ func verifySession(options *sessmodels.VerifySessionOptions) echo.MiddlewareFunc return func(c echo.Context) error { session.VerifySession(options, func(rw http.ResponseWriter, r *http.Request) { c.Set("session", session.GetSessionFromRequestContext(r.Context())) - hf(c) + + // Call the handler + err := hf(c) + if err != nil { + c.Error(err) + } })(c.Response(), c.Request()) + return nil } }