0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 15:09:10 -05:00

⬆️ Update potok dependency.

This commit is contained in:
Andrey Antukh 2020-08-19 13:05:38 +02:00
parent 5ae1b72943
commit e3faddeb6b
4 changed files with 29 additions and 39 deletions

View file

@ -11,14 +11,18 @@
danlentz/clj-uuid {:mvn/version "0.1.9"} danlentz/clj-uuid {:mvn/version "0.1.9"}
frankiesardo/linked {:mvn/version "1.3.0"} frankiesardo/linked {:mvn/version "1.3.0"}
funcool/beicon {:mvn/version "2020.05.08-2"}
funcool/cuerdas {:mvn/version "2020.03.26-3"}
funcool/lentes {:mvn/version "1.4.0-SNAPSHOT"} funcool/lentes {:mvn/version "1.4.0-SNAPSHOT"}
funcool/beicon {:mvn/version "2020.05.08-2"}
funcool/cuerdas {:mvn/version "2020.03.26-3"}
funcool/okulary {:mvn/version "2020.04.14-0"} funcool/okulary {:mvn/version "2020.04.14-0"}
funcool/potok {:mvn/version "2.8.0-SNAPSHOT"} funcool/potok {:mvn/version "2020.08.10-2"}
funcool/promesa {:mvn/version "5.1.0"} funcool/promesa {:mvn/version "5.1.0"}
funcool/rumext {:mvn/version "2020.05.22-1"} funcool/rumext {:mvn/version "2020.05.22-1"}
lambdaisland/uri {:mvn/version "1.3.45"
:exclusions [org.clojure/data.json]}
} }
:aliases :aliases
{:dev {:dev
@ -35,9 +39,6 @@
thheller/shadow-cljs {:mvn/version "2.10.19"} thheller/shadow-cljs {:mvn/version "2.10.19"}
lambdaisland/uri {:mvn/version "1.3.45"
:exclusions [org.clojure/data.json]}
;; i18n parsing ;; i18n parsing
carocad/parcera {:mvn/version "0.11.0"} carocad/parcera {:mvn/version "0.11.0"}
org.antlr/antlr4-runtime {:mvn/version "4.7"}}} org.antlr/antlr4-runtime {:mvn/version "4.7"}}}

View file

@ -23,9 +23,12 @@
(http/client-error? response) (http/client-error? response)
(rx/throw (:body response)) (rx/throw (:body response))
(http/server-error? response)
(rx/throw (:body response))
:else :else
(rx/throw {:type :unexpected (rx/throw {:type :unexpected
:code (:error response)}))) :response response})))
(defn send-query! (defn send-query!
[id params] [id params]

View file

@ -17,9 +17,9 @@
(def ^:dynamic *on-error* identity) (def ^:dynamic *on-error* identity)
(defonce state (l/atom {})) (defonce state (l/atom {}))
(defonce loader (l/atom false)) (defonce loader (l/atom false))
(defonce store (ptk/store {:on-error #(*on-error* %)})) (defonce store (ptk/store {:resolve ptk/resolve}))
(defonce stream (ptk/input-stream store)) (defonce stream (ptk/input-stream store))
(defn- repr-event (defn- repr-event

View file

@ -151,35 +151,21 @@
;; --- Error Handling ;; --- Error Handling
(defn- on-error (defmethod ptk/handle-error :validation
"A default error handler." [error]
[{:keys [type code] :as error}] (js/console.error (if (map? error) (pr-str error) error))
(reset! st/loader false) (when-let [explain (:explain error)]
(cond (println "============ SERVER RESPONSE ERROR ================")
(and (map? error) (println explain)
(= :validation type) (println "============ END SERVER RESPONSE ERROR ================")))
(= :spec-validation code))
(do
(println "============ SERVER RESPONSE ERROR ================")
(println (:explain error))
(println "============ END SERVER RESPONSE ERROR ================"))
;; Unauthorized or Auth timeout (defmethod ptk/handle-error :authentication
(and (map? error) [error]
(= :authentication type) (ts/schedule 0 #(st/emit! logout)))
(= :unauthorized code))
(ts/schedule 0 #(st/emit! logout))
;; Network error (defmethod ptk/handle-error :default
(and (map? error) [error]
(= :unexpected type) (js/console.error (if (map? error) (pr-str error) error))
(= :abort code)) (ts/schedule 100 #(st/emit! (dm/show {:content "Something wrong has happened."
(ts/schedule 100 #(st/emit! (dm/error (tr "errors.network")))) :type :error
:timeout 5000}))))
;; Something else
:else
(do
(js/console.error error)
(ts/schedule 100 #(st/emit! (dm/error (tr "errors.generic")))))))
(set! st/*on-error* on-error)