From 0bb8fa7e0601052172159061367a8fd98e9d9320 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 21 Feb 2017 17:49:17 +0100 Subject: [PATCH] Fix incorrect handling of error message timeouts. --- frontend/src/uxbox/main/ui.cljs | 15 +++++---------- frontend/src/uxbox/util/timers.cljs | 2 +- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/frontend/src/uxbox/main/ui.cljs b/frontend/src/uxbox/main/ui.cljs index e2f3857d4e..bedbac41d0 100644 --- a/frontend/src/uxbox/main/ui.cljs +++ b/frontend/src/uxbox/main/ui.cljs @@ -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) diff --git a/frontend/src/uxbox/util/timers.cljs b/frontend/src/uxbox/util/timers.cljs index 6d04ae12ef..806ef5dea8 100644 --- a/frontend/src/uxbox/util/timers.cljs +++ b/frontend/src/uxbox/util/timers.cljs @@ -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 +;; Copyright (c) 2016-2017 Andrey Antukh (ns uxbox.util.timers)