Replaced error pages with a new one.
This commit is contained in:
parent
d828c3adde
commit
7d9dc27411
@ -28,7 +28,7 @@ func (h *GuestbookApiHandlers) New(w http.ResponseWriter, r *http.Request) {
|
|||||||
r.ParseForm()
|
r.ParseForm()
|
||||||
|
|
||||||
if !inmemdb.Solve(captcha.ID(r.FormValue("captcha_id")), captcha.Answer(r.FormValue("captcha_answer"))) {
|
if !inmemdb.Solve(captcha.ID(r.FormValue("captcha_id")), captcha.Answer(r.FormValue("captcha_answer"))) {
|
||||||
ForbiddenError("Wrong answer given.", "Here's your message:"+r.FormValue("message"), w)
|
Error(w, http.StatusForbidden, "Wrong answer given.", "Here's your message:"+r.FormValue("message"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,13 +43,13 @@ func (h *GuestbookApiHandlers) New(w http.ResponseWriter, r *http.Request) {
|
|||||||
entry, err = justguestbook.NewEntry(r.FormValue("name"), message,
|
entry, err = justguestbook.NewEntry(r.FormValue("name"), message,
|
||||||
r.FormValue("website"), r.FormValue("hide_website") != "")
|
r.FormValue("website"), r.FormValue("hide_website") != "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
InternalError(err.Error(), "Here's your message:"+r.FormValue("message"), w)
|
Error(w, http.StatusInternalServerError, err.Error(), "Here's your message:"+r.FormValue("message"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = h.db.NewEntry(entry); err != nil {
|
if err = h.db.NewEntry(entry); err != nil {
|
||||||
InternalError(err.Error(), "Here's your message:"+r.FormValue("message"), w)
|
Error(w, http.StatusInternalServerError, err.Error(), "Here's your message:"+r.FormValue("message"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,8 @@ func (h *MindflowApiHandlers) NewPost(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err = h.db.NewPost(post); err != nil {
|
if err = h.db.NewPost(post); err != nil {
|
||||||
InternalError(err.Error(), "Title: "+r.FormValue("title")+" | Body: "+r.FormValue("body"), w)
|
msg := strings.Join([]string{"Title:", r.FormValue("title"), "| Body:", r.FormValue("body")}, " ")
|
||||||
|
Error(w, http.StatusInternalServerError, err.Error(), msg)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user