Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
:description "Liberator - A REST library for Clojure."
:url "http://clojure-liberator.github.io/liberator"
:dependencies [[org.clojure/clojure "1.4.0"]
[org.clojure/data.json "0.2.1"]
[org.clojure/data.json "0.2.5"]
[org.clojure/data.csv "0.1.2"]
[hiccup "1.0.3"]] ;; Used by code rendering default representations.
:deploy-repositories [["releases" :clojars]]
:lein-release {:deploy-via :clojars}

:license {:name "Eclipse Public License - v 1.0"
:url "http://www.eclipse.org/legal/epl-v10.html"
:distribution :repo
Expand All @@ -19,17 +18,17 @@
:plugins [[lein-midje "3.1.3" :exclusions [leiningen-core]]
[lein-ring "0.8.10" :exclusions [org.clojure/clojure]]]

:profiles {:dev {:dependencies [[ring/ring-jetty-adapter "1.2.1" :exclusions [joda-time]]
[ring-mock "0.1.2"]
[ring/ring-devel "1.2.1" :exclusions [joda-time]]
[midje "1.6.0" :exclusions [org.clojure/clojure]]
:profiles {:dev {:dependencies [[ring/ring-jetty-adapter "1.3.1" :exclusions [joda-time]]
[ring-mock "0.1.5"]
[ring/ring-devel "1.3.1" :exclusions [joda-time]]
[midje "1.6.3" :exclusions [org.clojure/clojure]]
;; only for examples
[compojure "1.0.2" :exclusions [org.clojure/tools.macro]]
[compojure "1.2.0" :exclusions [org.clojure/tools.macro]]
[org.clojure/clojurescript "0.0-1450"]]
:source-paths [ "src" "examples/clj"]}
:1.4 {:dependencies [[org.clojure/clojure "1.4.0"]]}
:1.5 {:dependencies [[org.clojure/clojure "1.5.1"]]}
:1.6 {:dependencies [[org.clojure/clojure "1.6.0-beta1"]]}}
:1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}}

:source-paths ["src"]
:test-paths ["test"]
Expand Down
10 changes: 10 additions & 0 deletions test/test_errors.clj
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,13 @@
:handle-exception (fn [_ _] (throw (RuntimeException. "bar"))))]
(fact (res (-> (request :get "/")
(header "Accept" "text/plain"))) => (throws RuntimeException))))

(facts "error throw by liberator itself don't get handle managment"
(let [resp ((resource
:service-available? (fn [_] {:resource [1 2]})
:exists? (fn [_] (throw (RuntimeException. "right")))
:handle-exception (fn [{ex :exception}]
(str "error: " (.getMessage ex))))
(request :get "/"))]
(fact resp => INTERNAL-SERVER-ERROR)
(fact resp => (body #"error: right"))))