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:
parent
5ae1b72943
commit
e3faddeb6b
4 changed files with 29 additions and 39 deletions
|
@ -11,14 +11,18 @@
|
|||
danlentz/clj-uuid {:mvn/version "0.1.9"}
|
||||
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/beicon {:mvn/version "2020.05.08-2"}
|
||||
funcool/cuerdas {:mvn/version "2020.03.26-3"}
|
||||
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/rumext {:mvn/version "2020.05.22-1"}
|
||||
|
||||
lambdaisland/uri {:mvn/version "1.3.45"
|
||||
:exclusions [org.clojure/data.json]}
|
||||
|
||||
}
|
||||
:aliases
|
||||
{:dev
|
||||
|
@ -35,9 +39,6 @@
|
|||
|
||||
thheller/shadow-cljs {:mvn/version "2.10.19"}
|
||||
|
||||
lambdaisland/uri {:mvn/version "1.3.45"
|
||||
:exclusions [org.clojure/data.json]}
|
||||
|
||||
;; i18n parsing
|
||||
carocad/parcera {:mvn/version "0.11.0"}
|
||||
org.antlr/antlr4-runtime {:mvn/version "4.7"}}}
|
||||
|
|
|
@ -23,9 +23,12 @@
|
|||
(http/client-error? response)
|
||||
(rx/throw (:body response))
|
||||
|
||||
(http/server-error? response)
|
||||
(rx/throw (:body response))
|
||||
|
||||
:else
|
||||
(rx/throw {:type :unexpected
|
||||
:code (:error response)})))
|
||||
:response response})))
|
||||
|
||||
(defn send-query!
|
||||
[id params]
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
|
||||
(def ^:dynamic *on-error* identity)
|
||||
|
||||
(defonce state (l/atom {}))
|
||||
(defonce state (l/atom {}))
|
||||
(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))
|
||||
|
||||
(defn- repr-event
|
||||
|
|
|
@ -151,35 +151,21 @@
|
|||
|
||||
;; --- Error Handling
|
||||
|
||||
(defn- on-error
|
||||
"A default error handler."
|
||||
[{:keys [type code] :as error}]
|
||||
(reset! st/loader false)
|
||||
(cond
|
||||
(and (map? error)
|
||||
(= :validation type)
|
||||
(= :spec-validation code))
|
||||
(do
|
||||
(println "============ SERVER RESPONSE ERROR ================")
|
||||
(println (:explain error))
|
||||
(println "============ END SERVER RESPONSE ERROR ================"))
|
||||
(defmethod ptk/handle-error :validation
|
||||
[error]
|
||||
(js/console.error (if (map? error) (pr-str error) error))
|
||||
(when-let [explain (:explain error)]
|
||||
(println "============ SERVER RESPONSE ERROR ================")
|
||||
(println explain)
|
||||
(println "============ END SERVER RESPONSE ERROR ================")))
|
||||
|
||||
;; Unauthorized or Auth timeout
|
||||
(and (map? error)
|
||||
(= :authentication type)
|
||||
(= :unauthorized code))
|
||||
(ts/schedule 0 #(st/emit! logout))
|
||||
(defmethod ptk/handle-error :authentication
|
||||
[error]
|
||||
(ts/schedule 0 #(st/emit! logout)))
|
||||
|
||||
;; Network error
|
||||
(and (map? error)
|
||||
(= :unexpected type)
|
||||
(= :abort code))
|
||||
(ts/schedule 100 #(st/emit! (dm/error (tr "errors.network"))))
|
||||
|
||||
;; Something else
|
||||
:else
|
||||
(do
|
||||
(js/console.error error)
|
||||
(ts/schedule 100 #(st/emit! (dm/error (tr "errors.generic")))))))
|
||||
|
||||
(set! st/*on-error* on-error)
|
||||
(defmethod ptk/handle-error :default
|
||||
[error]
|
||||
(js/console.error (if (map? error) (pr-str error) error))
|
||||
(ts/schedule 100 #(st/emit! (dm/show {:content "Something wrong has happened."
|
||||
:type :error
|
||||
:timeout 5000}))))
|
||||
|
|
Loading…
Add table
Reference in a new issue