summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0a0d73d)
raw | patch | inline | side by side (parent: 0a0d73d)
author | Sebastian Harl <sh@tokkee.org> | |
Wed, 26 Nov 2014 21:10:00 +0000 (22:10 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Wed, 26 Nov 2014 21:10:00 +0000 (22:10 +0100) |
This might confuse browsers and, more importantly, now we re-populate the
query input field with the user's query in case it failed.
query input field with the user's query in case it failed.
server/server.go | patch | blob | history |
diff --git a/server/server.go b/server/server.go
index 6b3f8d07a57e5ae715fb828df75cb1f4c556332c..c0f449cd451dd8d735107c8d8ca877f6fa5aabbc 100644 (file)
--- a/server/server.go
+++ b/server/server.go
return
}
r.ParseForm()
- page, err := f(req, s)
+ p, err := f(req, s)
if err != nil {
- s.badrequest(w, fmt.Errorf("Error: %v", err))
- return
+ p = &page{
+ Content: "<section class=\"error\">" +
+ html(fmt.Sprintf("Error: %v", err)) +
+ "</section>",
+ }
}
- page.Query = r.FormValue("query")
- if page.Title == "" {
- page.Title = "SysDB - The System Database"
+ p.Query = r.FormValue("query")
+ if p.Title == "" {
+ p.Title = "SysDB - The System Database"
}
var buf bytes.Buffer
- err = s.main.Execute(&buf, page)
+ err = s.main.Execute(&buf, p)
if err != nil {
s.internal(w, err)
return