Skip to content

Commit

Permalink
Log the filename if any of the abacus requests fail
Browse files Browse the repository at this point in the history
  • Loading branch information
egli committed Jan 26, 2024
1 parent 935494b commit e392cb9
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/clj/mdr2/routes/services.clj
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,9 @@
(created (str "productions/" (:id p)) {}))
(catch clojure.lang.ExceptionInfo e
(let [{:keys [error-id errors]} (ex-data e)
message (ex-message e)]
(log/error message error-id errors)
message (ex-message e)
{:keys [filename tempfile]} file]
(log/error message error-id errors filename (str tempfile))
(case error-id
:duplicate-key
(bad-request {:status-text message})
Expand All @@ -331,8 +332,9 @@
(no-content)
(catch clojure.lang.ExceptionInfo e
(let [{:keys [error-id errors]} (ex-data e)
message (ex-message e)]
(log/error message error-id errors)
message (ex-message e)
{:keys [filename]} file]
(log/error message error-id errors filename)
(case error-id
:product-not-found (not-found)
:invalid-state (bad-request {:status-text message})
Expand All @@ -350,8 +352,9 @@
(no-content)
(catch clojure.lang.ExceptionInfo e
(let [{:keys [error-id errors]} (ex-data e)
message (ex-message e)]
(log/error message error-id errors)
message (ex-message e)
{:keys [filename tempfile]} file]
(log/error message error-id errors filename (str tempfile))
(case error-id
:product-not-found (not-found)
:invalid-xml (bad-request {:status-text "Upload of ABACUS XML failed" :errors errors})
Expand All @@ -366,8 +369,9 @@
(no-content))
(catch clojure.lang.ExceptionInfo e
(let [{:keys [error-id errors]} (ex-data e)
message (ex-message e)]
(log/error message error-id errors)
message (ex-message e)
{:keys [filename tempfile]} file]
(log/error message error-id errors filename (str tempfile))
(case error-id
:invalid-xml (bad-request {:status-text "Upload of ABACUS XML failed"
:errors errors})
Expand Down

0 comments on commit e392cb9

Please sign in to comment.