a lot of progress towards unification.

This commit is contained in:
Bryce Covert
2019-02-16 18:10:14 -08:00
parent 12eb4bdd41
commit 193a46e12c
7 changed files with 243 additions and 195 deletions

View File

@@ -21,7 +21,15 @@
:body (pr-str (ql/query (:identity r) (query-params "query") variables ))
:headers {"Content-Type" "application/edn"}})
(catch Exception e
{:status 400
:body (pr-str {:data (merge {:message (.getMessage e)} (ex-data e))})
:headers {"Content-Type" "application/edn"}}))))
(if-let [result (:result (ex-data e))]
{:status 400
:body (pr-str result)
:headers {"Content-Type" "application/edn"}}
(if-let [message (:validation-error (ex-data e) )]
{:status 400
:body (pr-str {:errors [(merge {:message message} (ex-data e))]})
:headers {"Content-Type" "application/edn"}}
{:status 500
:body (pr-str {:errors [(merge {:message (.getMessage e)} (ex-data e))]})
:headers {"Content-Type" "application/edn"}}))))))
wrap-secure))