0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 08:50:57 -05:00

🐛 Fix unexpected exception on time equiv impl.

This commit is contained in:
Andrey Antukh 2022-01-17 17:48:42 +01:00 committed by Alonso Torres
parent 2aeded1940
commit 1d174a4379
3 changed files with 13 additions and 16 deletions

View file

@ -217,11 +217,7 @@
(ex/raise :type :assertion (ex/raise :type :assertion
:code :spec-validation :code :spec-validation
:hint hint :hint hint
::ex/data ctx ::ex/data (merge ctx data)))))
::s/value val
::s/problems (::s/problems data)))))
(defmacro assert (defmacro assert
"Development only assertion macro." "Development only assertion macro."

View file

@ -106,14 +106,14 @@
;; assertion (assertion that is preserved on production builds). From ;; assertion (assertion that is preserved on production builds). From
;; the user perspective this should be treated as internal error. ;; the user perspective this should be treated as internal error.
(defmethod ptk/handle-error :assertion (defmethod ptk/handle-error :assertion
[{:keys [data stack message hint context] :as error}] [{:keys [message hint] :as error}]
(let [message (or message hint) (let [message (or message hint)
message (str "Internal Assertion Error: " message) message (str "Internal Assertion Error: " message)
context (str/fmt "ns: '%s'\nname: '%s'\nfile: '%s:%s'" context (str/fmt "ns: '%s'\nname: '%s'\nfile: '%s:%s'"
(:ns context) (:ns error)
(:name context) (:name error)
(str cf/public-uri "js/cljs-runtime/" (:file context)) (str cf/public-uri "js/cljs-runtime/" (:file error))
(:line context))] (:line error))]
(ts/schedule (ts/schedule
(st/emitf (st/emitf
(dm/show {:content "Internal error: assertion." (dm/show {:content "Internal error: assertion."
@ -123,10 +123,7 @@
;; Print to the console some debugging info ;; Print to the console some debugging info
(js/console.group message) (js/console.group message)
(js/console.info context) (js/console.info context)
(js/console.groupCollapsed "Stack Trace") (js/console.error (with-out-str (expound/printer error)))
(js/console.info stack)
(js/console.groupEnd "Stack Trace")
(js/console.error (with-out-str (expound/printer data)))
(js/console.groupEnd message))) (js/console.groupEnd message)))
;; This happens when the backed server fails to process the ;; This happens when the backed server fails to process the

View file

@ -106,11 +106,15 @@
(extend-protocol IEquiv (extend-protocol IEquiv
DateTime DateTime
(-equiv [it other] (-equiv [it other]
(.equals it other)) (if other
(.equals it other)
false))
Duration Duration
(-equiv [it other] (-equiv [it other]
(.equals it other))) (if other
(.equals it other)
false)))
(extend-protocol Inst (extend-protocol Inst
DateTime DateTime