From cea98cc6f5419c5ef0001b7fec0ce656af70cbd6 Mon Sep 17 00:00:00 2001 From: Daniel Compton Date: Wed, 17 Apr 2019 05:03:31 +1200 Subject: [PATCH] Include exception cause in ex-info (#285) This ensures that the full stack trace of errors will be preserved. --- src/yada/interceptors.clj | 2 +- src/yada/methods.clj | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/yada/interceptors.clj b/src/yada/interceptors.clj index 0808ceae..9216795f 100644 --- a/src/yada/interceptors.clj +++ b/src/yada/interceptors.clj @@ -104,7 +104,7 @@ (try (Long/parseLong len) (catch Exception e - (throw (ex-info "Malformed Content-Length" {:value len}))))))) + (throw (ex-info "Malformed Content-Length" {:value len} e))))))) (defn get-properties [ctx] diff --git a/src/yada/methods.clj b/src/yada/methods.clj index 54b6f0a5..86a9fb49 100644 --- a/src/yada/methods.clj +++ b/src/yada/methods.clj @@ -191,9 +191,11 @@ (fn [e] (if (:status (ex-data e)) (throw e) - (throw (ex-info "Error on GET" {:response (:response ctx) - :resource (type (:resource ctx)) - :error e})))))))) + (throw (ex-info "Error on GET" + {:response (:response ctx) + :resource (type (:resource ctx)) + :error e} + e)))))))) ;; --------------------------------------------------------------------------------