mirror of
https://github.com/penpot/penpot.git
synced 2025-06-03 07:51:37 +02:00
Fix incorrect handling of error message timeouts.
This commit is contained in:
parent
8f08a23615
commit
0bb8fa7e06
2 changed files with 6 additions and 11 deletions
|
@ -51,31 +51,26 @@
|
|||
(defn- on-error
|
||||
"A default error handler."
|
||||
[{:keys [status] :as error}]
|
||||
(js/console.log "on-error:" (pr-str error))
|
||||
(js/console.log "stack:" (.-stack error))
|
||||
(js/console.error "on-error:" (pr-str error))
|
||||
(reset! st/loader false)
|
||||
(cond
|
||||
;; Unauthorized or Auth timeout
|
||||
(and (:status error)
|
||||
(or (= (:status error) 403)
|
||||
(= (:status error) 419)))
|
||||
(st/emit! (logout))
|
||||
(ts/schedule 100 #(st/emit! (logout)))
|
||||
|
||||
;; Conflict
|
||||
(= status 412)
|
||||
(st/emit! (uum/error (tr "errors.conflict")))
|
||||
(ts/schedule 100 #(st/emit! (uum/error (tr "errors.conflict"))))
|
||||
|
||||
;; Network error
|
||||
(= (:status error) 0)
|
||||
(do
|
||||
(st/emit! (uum/error (tr "errors.network")))
|
||||
(js/console.error "Stack:" (.-stack error)))
|
||||
(ts/schedule 100 #(st/emit! (uum/error (tr "errors.network"))))
|
||||
|
||||
;; Something else
|
||||
:else
|
||||
(do
|
||||
(st/emit! (uum/error (tr "errors.generic")))
|
||||
(js/console.error "Stack:" (.-stack error)))))
|
||||
(ts/schedule 100 #(st/emit! (uum/error (tr "errors.generic"))))))
|
||||
|
||||
(set! st/*on-error* on-error)
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
;;
|
||||
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
|
||||
;; Copyright (c) 2016-2017 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.util.timers)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue