Browse Source

ex eption handling added

master
Christian Mueller 12 years ago
parent
commit
8178d82e67
  1. 8
      messages
  2. 13
      src/notehub/handler.clj

8
messages

@ -3,10 +3,10 @@ title = Free and Hassle-free Pastebin for Markdown Pages. @@ -3,10 +3,10 @@ title = Free and Hassle-free Pastebin for Markdown Pages.
name = NoteHub
new-page = New Page
status-404 = Nothing found.
status-400 = Bad Request.
status-403 = Wrong Password.
status-500 = OMG, Server Exploded.
status-404 = Not Found
status-400 = Bad Request
status-403 = Forbidden
status-500 = Internal Server Error
footer = Created by [@gravitydenier](http://twitter.com/gravitydenier) ♣ Available on [GitHub](https://github.com/chmllr/NoteHub)

13
src/notehub/handler.clj

@ -15,7 +15,6 @@ @@ -15,7 +15,6 @@
[notehub.storage :as storage]
[cheshire.core :refer :all]))
; Creates the main html layout
(defn layout
[title & content]
@ -35,7 +34,6 @@ @@ -35,7 +34,6 @@
(if-not (get-setting :dev-mode) (include-js "/js/google-analytics.js"))]
[:body {:onload "onLoad()"} content]))
(defn md-node
"Returns an HTML element with a textarea inside
containing the markdown text (to keep all chars unescaped)"
@ -91,7 +89,6 @@ @@ -91,7 +89,6 @@
:body content})
(defroutes api-routes
(GET "/" [] (layout (get-message :api-title)
(md-node :article (slurp "API.md"))))
@ -205,4 +202,12 @@ @@ -205,4 +202,12 @@
(route/not-found (response 404)))
(def app
(handler/site app-routes))
(let [handler (handler/site app-routes)]
(fn [request]
(if (get-setting :dev-mode)
(handler request)
(try (handler request)
(catch Exception e
(do
;TODO (log e)
(response 500))))))))

Loading…
Cancel
Save