1
0

Moved misplaced error handler, added Error(...) to show what error happened.

This commit is contained in:
Alexander Andreev 2023-06-04 18:08:21 +04:00
parent 339fbe354d
commit 405bc6d2d7
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -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)
} }