Log error when flushing fails
This commit is contained in:
parent
0f85c01e57
commit
12f65072f2
36
main.go
36
main.go
|
@ -96,7 +96,11 @@ func (*authHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer sess.Flush()
|
defer func() {
|
||||||
|
if err := sess.Flush(); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
if r.Method == http.MethodGet {
|
if r.Method == http.MethodGet {
|
||||||
if r.URL.Path == "/auth/login" {
|
if r.URL.Path == "/auth/login" {
|
||||||
|
@ -204,7 +208,11 @@ func (h *historyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer sess.Flush()
|
defer func() {
|
||||||
|
if err := sess.Flush(); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
if !sess.LoggedIn {
|
if !sess.LoggedIn {
|
||||||
http.Redirect(w, r, "/", http.StatusFound)
|
http.Redirect(w, r, "/", http.StatusFound)
|
||||||
|
@ -253,7 +261,11 @@ func (h *saveHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer sess.Flush()
|
defer func() {
|
||||||
|
if err := sess.Flush(); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
if !sess.LoggedIn {
|
if !sess.LoggedIn {
|
||||||
http.Redirect(w, r, "/", http.StatusFound)
|
http.Redirect(w, r, "/", http.StatusFound)
|
||||||
|
@ -280,7 +292,11 @@ func (h *editHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer sess.Flush()
|
defer func() {
|
||||||
|
if err := sess.Flush(); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
if !sess.LoggedIn {
|
if !sess.LoggedIn {
|
||||||
http.Redirect(w, r, "/", http.StatusFound)
|
http.Redirect(w, r, "/", http.StatusFound)
|
||||||
|
@ -321,7 +337,11 @@ func (h *indexHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer sess.Flush()
|
defer func() {
|
||||||
|
if err := sess.Flush(); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
page := r.URL.Path[1:]
|
page := r.URL.Path[1:]
|
||||||
if page == "" {
|
if page == "" {
|
||||||
|
@ -380,7 +400,11 @@ func (h *recentHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer sess.Flush()
|
defer func() {
|
||||||
|
if err := sess.Flush(); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
if !sess.LoggedIn {
|
if !sess.LoggedIn {
|
||||||
http.Redirect(w, r, "/", http.StatusFound)
|
http.Redirect(w, r, "/", http.StatusFound)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user