Permalink
Browse files

Add HTTP 500 handler for the API

  • Loading branch information...
1 parent c64a74d commit a615827daf9fad8cfdad7166705f68a6a7db8307 @dakrone committed Nov 16, 2012
Showing with 9 additions and 1 deletion.
  1. +1 −0 README.md
  2. +8 −1 src/eisago/api.clj
View
@@ -259,6 +259,7 @@ Expect that this API might change between now and any time this is released.
- API for adding examples
- API for adding comments
+- Tests!
## See Also
View
@@ -10,6 +10,12 @@
[req]
{:status 404 :body (json/encode {:status 404 :message "Invalid request"})})
+(defn error
+ "Response for API 500 errors"
+ [req]
+ {:status 500 :body (json/encode {:status 500
+ :message "There was an unknown error"})})
+
(defn search
"API implementation of searching, lib and namespace can be optionally
specified as paths, with name and query optionally specified in
@@ -75,7 +81,8 @@
#"^/_stats/?$" #'stats
- :404 #'missing))
+ :404 #'missing
+ :500 #'error))
(defn start-server []
(laeggen/start (assoc (config :laeggen) :urls urls)))

0 comments on commit a615827

Please sign in to comment.