1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-30 08:17:18 +00:00
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-08-28 02:22:38 +03:00
parent 39e3911d41
commit 933534574a
3 changed files with 15 additions and 3 deletions

View File

@@ -131,7 +131,11 @@ var BuiltinDependencies = []*Dependency{
NewDependency(func(ctx *context.Context) *sessions.Session {
session := sessions.Get(ctx)
if session == nil {
panic("binding: session is nil - app.Use(sess.Handler()) to fix it")
ctx.Application().Logger().Debugf("binding: session is nil\nMaybe inside HandleHTTPError? Register it with app.UseRouter(sess.Handler()) to fix it")
// let's don't panic here and let the application continue, now we support
// not matched routes inside the controller through HandleHTTPError,
// so each dependency can check if session was not nil or just use `UseRouter` instead of `Use`
// to register the sessions middleware.
}
return session