diff options
| author | horus_arch | 2015-04-19 22:09:52 +0200 |
|---|---|---|
| committer | horus_arch | 2015-04-19 22:09:52 +0200 |
| commit | 01e9a34952bd6ddd383680b0ca2312e476ad07a6 (patch) | |
| tree | 00902575e5c271cc5d35ea65aa8795b8caeb97bc /server/error.go | |
| download | mandible-01e9a34952bd6ddd383680b0ca2312e476ad07a6.tar.gz | |
Initial commit.
Diffstat (limited to 'server/error.go')
| -rw-r--r-- | server/error.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/server/error.go b/server/error.go new file mode 100644 index 0000000..f8325f9 --- /dev/null +++ b/server/error.go @@ -0,0 +1,17 @@ +package server + +import ( + "net/http" +) + +func errorHandler(w http.ResponseWriter, r *http.Request, status int) { + w.WriteHeader(status) + if status == http.StatusNotFound { + templ := mainTempl.Lookup("404.html") + err := templ.ExecuteTemplate(w, "404.html", r.URL.Path) + if err != nil { + ErrorResponse(w, err.Error(), http.StatusInternalServerError) + return + } + } +} |
