Skip to content

Commit

Permalink
Adding crash resistance
Browse files Browse the repository at this point in the history
  • Loading branch information
COMTOP1 committed Oct 15, 2023
1 parent 9c966a1 commit 2cf6e6e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion views/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,19 @@ func (v *Views) getSessionData(eC echo.Context) *Context {
session, err := v.cookie.Get(eC.Request(), v.conf.SessionCookieName)
if err != nil {
log.Printf("error getting session: %+v", err)
return nil
err = session.Save(eC.Request(), eC.Response())
if err != nil {
panic(fmt.Errorf("failed to save user session for getSessionData: %w", err))
}
i := InternalContext{}
c := &Context{
TitleText: i.TitleText,
Message: i.Message,
MsgType: i.MesType,
Callback: "/internal",
Version: v.conf.Version,
}
return c
}

var u, actual user.User
Expand Down

0 comments on commit 2cf6e6e

Please sign in to comment.