diff --git a/src/fluree/db/api/query.cljc b/src/fluree/db/api/query.cljc index 0cbed6673..e92ab5766 100644 --- a/src/fluree/db/api/query.cljc +++ b/src/fluree/db/api/query.cljc @@ -1,7 +1,7 @@ (ns fluree.db.api.query "Primary API ns for any user-invoked actions. Wrapped by language & use specific APIS that are directly exposed" - (:require [clojure.core.async :as async :refer [ coerced-query did (assoc-in [:opts :did] did))] ( (:opts flureeQL) did (assoc :did did)) db (if-let [policy-opts (perm/policy-opts global-opts)] ( e ex-data :data :explain me/humanize)}))))) + :reasons (v/humanize-error e)}))))) (def coerce-modification* (m/coercer ::modification (mt/transformer {:name :fql}) {:registry registry})) @@ -180,4 +180,4 @@ (throw (ex-info "Invalid Ledger Modification" {:status 400 :error :db/invalid-query - :reasons (-> e ex-data :data :explain me/humanize)}))))) + :reasons (v/humanize-error e)}))))) diff --git a/src/fluree/db/query/history.cljc b/src/fluree/db/query/history.cljc index 146517d49..f61a5d762 100644 --- a/src/fluree/db/query/history.cljc +++ b/src/fluree/db/query/history.cljc @@ -103,10 +103,6 @@ (def explain-error (m/explainer ::history-query {:registry registry})) -(defn humanize-error - [query-validation-error] - (-> query-validation-error Throwable->map :data :data :explain me/humanize)) - (def parse-history-query (m/parser ::history-query {:registry registry})) diff --git a/src/fluree/db/validation.cljc b/src/fluree/db/validation.cljc index db5608de8..90e12ea28 100644 --- a/src/fluree/db/validation.cljc +++ b/src/fluree/db/validation.cljc @@ -1,7 +1,8 @@ (ns fluree.db.validation (:require [fluree.db.util.core :refer [pred-ident?]] [fluree.db.constants :as const] - [malli.core :as m])) + [malli.core :as m] + [malli.error :as me])) (defn iri? [v] @@ -54,6 +55,10 @@ [x] (or (fn-string? x) (fn-list? x))) +(defn humanize-error + [error] + (-> error ex-data :data :explain me/humanize)) + (def registry (merge (m/base-schemas)