Skip to content

Commit

Permalink
Implemented suggestion from Thomas Lee for more descriptive exception…
Browse files Browse the repository at this point in the history
… when no matching routes
  • Loading branch information
weavejester committed Jun 13, 2009
1 parent 8b5da2e commit 3f0b5a4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/compojure/http/servlet.clj
Expand Up @@ -104,9 +104,11 @@
(defn request-handler
"Handle incoming HTTP requests from a servlet."
[[servlet request response] routes]
(do (.setCharacterEncoding response "UTF-8")
(update-servlet-response response
(routes (create-request request servlet)))))
(.setCharacterEncoding response "UTF-8")
(if-let [response-map (routes (create-request request servlet))]
(update-servlet-response response response-map)
(throw (NullPointerException.
"Handler returned nil (maybe no routes matched URI)"))))

(definline servlet
"Create a servlet from a sequence of routes. Automatically updates if
Expand Down

0 comments on commit 3f0b5a4

Please sign in to comment.