Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions src/main/com/yetanalytics/lrs/pedestal/routes/documents.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,11 @@
(defn put-response
[ctx {:keys [error]}]
(if error
(assoc ctx :io.pedestal.interceptor.chain/error error)
(let [exd (ex-data error)]
(if (#{:com.yetanalytics.lrs.xapi.document/precondition-failed}
(:type exd))
(assoc ctx :response {:status 412})
(assoc ctx :io.pedestal.interceptor.chain/error error)))
(assoc ctx :response {:status 204})))


Expand Down Expand Up @@ -375,11 +379,18 @@
[ctx {:keys [error] :as _lrs-response}]
(if error
(let [exd (ex-data error)]
(if (#{:com.yetanalytics.lrs.xapi.document/json-read-error
:com.yetanalytics.lrs.xapi.document/json-not-object-error
:com.yetanalytics.lrs.xapi.document/invalid-merge}
(:type exd))
(cond
(#{:com.yetanalytics.lrs.xapi.document/precondition-failed}
(:type exd))
(assoc ctx :response {:status 412})

(#{:com.yetanalytics.lrs.xapi.document/json-read-error
:com.yetanalytics.lrs.xapi.document/json-not-object-error
:com.yetanalytics.lrs.xapi.document/invalid-merge}
(:type exd))
(assoc ctx :response {:status 400})

:else
(assoc ctx :io.pedestal.interceptor.chain/error error)))
(assoc ctx :response {:status 204})))

Expand Down