Makes logging unified
This commit is contained in:
@@ -4,12 +4,11 @@
|
||||
[auto-ap.datomic.clients :as d-clients]
|
||||
[auto-ap.graphql :as ql]
|
||||
[auto-ap.graphql.utils :refer [limited-clients]]
|
||||
[auto-ap.logging :refer [warn-event]]
|
||||
[auto-ap.logging :as alog]
|
||||
[auto-ap.routes.utils :refer [wrap-secure]]
|
||||
[buddy.auth :refer [throw-unauthorized]]
|
||||
[clojure.edn :as edn]
|
||||
[clojure.set :as set]
|
||||
[clojure.tools.logging :as log]
|
||||
[datomic.api :as dc]))
|
||||
|
||||
|
||||
@@ -30,21 +29,21 @@
|
||||
clients) ))
|
||||
:headers {"Content-Type" "application/edn"}})
|
||||
(catch Throwable e
|
||||
(log/info "here we are " (.getCause e))
|
||||
|
||||
(if-let [result (:result (ex-data e))]
|
||||
(do (log/warn "Graphql Result error" e)
|
||||
(do (alog/warn ::result-error :error e)
|
||||
{:status 400
|
||||
:body (pr-str result)
|
||||
:headers {"Content-Type" "application/edn"}})
|
||||
(if-let [message (:validation-error (ex-data (.getCause e)) )]
|
||||
(do
|
||||
(warn-event "GraphQL Validation error" {:message message
|
||||
:data e})
|
||||
(alog/warn ::graphql-validation-error
|
||||
:message message
|
||||
:error e)
|
||||
{:status 400
|
||||
:body (pr-str {:errors [{:message message}]})
|
||||
:headers {"Content-Type" "application/edn"}})
|
||||
(do (log/error "GraphQL error" e)
|
||||
(do (alog/error ::error :error e)
|
||||
{:status 500
|
||||
:body (pr-str {:errors [{:message (str "Unhandled error:" (str e))}]})
|
||||
:headers {"Content-Type" "application/edn"}}))))))
|
||||
|
||||
Reference in New Issue
Block a user