mirror of
https://github.com/penpot/penpot.git
synced 2025-06-11 00:41:38 +02:00
✨ Improve error reporting on frontend.
This commit is contained in:
parent
046ee7e475
commit
6448592929
2 changed files with 71 additions and 25 deletions
|
@ -20,20 +20,24 @@
|
|||
(http/success? response)
|
||||
(rx/of (:body response))
|
||||
|
||||
(or (http/client-error? response)
|
||||
(= 500 (:status response)))
|
||||
(= (:status response) 400)
|
||||
(rx/throw (:body response))
|
||||
|
||||
(= 502 (:status response))
|
||||
(rx/throw {:type :bad-gateway
|
||||
:body (:body response)})
|
||||
(= (:status response) 401)
|
||||
(rx/throw {:type :authentication
|
||||
:code :not-authenticated})
|
||||
|
||||
(= (:status response) 403)
|
||||
(rx/throw {:type :authorization
|
||||
:code :not-authorized})
|
||||
|
||||
(= 0 (:status response))
|
||||
(rx/throw {:type :offline})
|
||||
|
||||
:else
|
||||
(rx/throw {:type :unexpected
|
||||
:response response})))
|
||||
(rx/throw {:type :internal-error
|
||||
:status (:status response)
|
||||
:body (:body response)})))
|
||||
|
||||
(defn send-query!
|
||||
[id params]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue