From 23f7648cb8c17faba21d3d7c4c2deb59c3fa8966 Mon Sep 17 00:00:00 2001 From: siscia Date: Wed, 15 Oct 2014 09:46:23 +0200 Subject: [PATCH 1/2] update dependencies --- project.clj | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/project.clj b/project.clj index b67b824..19b751f 100644 --- a/project.clj +++ b/project.clj @@ -1,9 +1,9 @@ (defproject liberator "0.12.0" :description "Liberator - A REST library for Clojure." :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. + [hiccup "1.0.5"]] ;; Used by code rendering default representations. :license {:name "Eclipse Public License - v 1.0" :url "http://www.eclipse.org/legal/epl-v10.html" @@ -16,17 +16,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"] From 8abe482a42615e028742728d6d2c7e1bd24ae438 Mon Sep 17 00:00:00 2001 From: siscia Date: Sun, 14 Dec 2014 03:21:54 +0100 Subject: [PATCH 2/2] add test case that fail --- test/test_errors.clj | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/test_errors.clj b/test/test_errors.clj index 3e886e5..7741a10 100644 --- a/test/test_errors.clj +++ b/test/test_errors.clj @@ -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"))))