Moved misplaced error handler, added Error(...) to show what error happened.
This commit is contained in:
parent
339fbe354d
commit
405bc6d2d7
@ -143,12 +143,13 @@ func (h *Handlers) Guestbook(w http.ResponseWriter, r *http.Request) {
|
|||||||
func (h *Handlers) GuestbookAdmin(w http.ResponseWriter, r *http.Request) {
|
func (h *Handlers) GuestbookAdmin(w http.ResponseWriter, r *http.Request) {
|
||||||
entriesCount, _ := h.guestbookDB.Count()
|
entriesCount, _ := h.guestbookDB.Count()
|
||||||
entries, err := h.guestbookDB.Entries(1, entriesCount)
|
entries, err := h.guestbookDB.Entries(1, entriesCount)
|
||||||
|
if err != nil {
|
||||||
|
Error(w, http.StatusInternalServerError, err.Error(), "cannot load gb")
|
||||||
|
return
|
||||||
|
}
|
||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
entry.Message = strings.ReplaceAll(entry.Message, "\\n", "\n")
|
entry.Message = strings.ReplaceAll(entry.Message, "\\n", "\n")
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
web.GuestbookAdmin("/ Guestbook Administration", h.guestbookOwner, entries, r, w)
|
web.GuestbookAdmin("/ Guestbook Administration", h.guestbookOwner, entries, r, w)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user