summaryrefslogtreecommitdiff
path: root/server/error.go
diff options
context:
space:
mode:
authorhorus_arch2015-04-19 22:09:52 +0200
committerhorus_arch2015-04-19 22:09:52 +0200
commit01e9a34952bd6ddd383680b0ca2312e476ad07a6 (patch)
tree00902575e5c271cc5d35ea65aa8795b8caeb97bc /server/error.go
downloadmandible-01e9a34952bd6ddd383680b0ca2312e476ad07a6.tar.gz
Initial commit.
Diffstat (limited to 'server/error.go')
-rw-r--r--server/error.go17
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
+ }
+ }
+}