Skip to content

Commit f08e1fc

Browse files
asjdfunknwon
andauthored
load: ignore context cancel error (#64)
Co-authored-by: Joe Chen <[email protected]>
1 parent 4842fc5 commit f08e1fc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

session.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ func Sessioner(opts ...Options) flamego.Handler {
172172
sid := opt.ReadIDFunc(c.Request().Request)
173173
sess, created, err := mgr.load(c.Request().Request, sid, opt.IDLength)
174174
if err != nil {
175+
if errors.Cause(err) == context.Canceled {
176+
c.ResponseWriter().WriteHeader(http.StatusUnprocessableEntity)
177+
return
178+
}
175179
panic("session: load: " + err.Error())
176180
}
177181

0 commit comments

Comments
 (0)