diff --git a/api/src/clojure/org/akvo/flow_api/anomaly.clj b/api/src/clojure/org/akvo/flow_api/anomaly.clj index 0aca6b5..5737554 100644 --- a/api/src/clojure/org/akvo/flow_api/anomaly.clj +++ b/api/src/clojure/org/akvo/flow_api/anomaly.clj @@ -6,7 +6,7 @@ (map? m)]} (throw (ex-info message (assoc m :org.akvo.flow-api/anomaly key)))) -(defn not-found [message m] +(defn not-found [^String message m] (throw-anomaly ::not-found message m)) (defn unauthorized [message m] diff --git a/api/src/clojure/org/akvo/flow_api/middleware/anomaly.clj b/api/src/clojure/org/akvo/flow_api/middleware/anomaly.clj index 4d853d3..ea5e4d6 100644 --- a/api/src/clojure/org/akvo/flow_api/middleware/anomaly.clj +++ b/api/src/clojure/org/akvo/flow_api/middleware/anomaly.clj @@ -2,7 +2,7 @@ (:require [org.akvo.flow-api.endpoint.anomaly :as anomaly] [org.akvo.flow-api.anomaly :as an] #_[clojure.tools.logging :as log] - [clojure.stacktrace :as stacktrace]) + #_[clojure.stacktrace :as stacktrace]) (:import [clojure.lang ExceptionInfo])) (defn wrap-anomaly [handler] @@ -17,13 +17,14 @@ "Over Quota" (an/too-many-requests) "required more quota" (an/too-many-requests) "Please try again in 30 seconds" (an/bad-gateway) - (throw e))) + ((println (str "The message" e)) + (throw e)))) (defn wrap-log-errors [handler] (fn [request] (try (handler request) (catch Throwable e - (stacktrace/print-stack-trace e) + #_(stacktrace/print-stack-trace e) #_(log/error e (str "Error:" (.getMessage e))) (translate-exception e))))) diff --git a/api/src/clojure/org/akvo/flow_api/middleware/resolve_alias.clj b/api/src/clojure/org/akvo/flow_api/middleware/resolve_alias.clj index 112ff1e..be25b51 100644 --- a/api/src/clojure/org/akvo/flow_api/middleware/resolve_alias.clj +++ b/api/src/clojure/org/akvo/flow_api/middleware/resolve_alias.clj @@ -10,5 +10,4 @@ (handler (assoc request :instance-id instance-id :alias alias))) - (anomaly/not-found "Could not resolve alias" - {:alias alias})))) + (anomaly/not-found (str alias " instance not found.") {}))))