File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -8810,7 +8810,11 @@ reduces them without incurring seq initialization"
8810
8810
(-write writer obj))
8811
8811
8812
8812
^boolean (goog/isFunction obj)
8813
- (write-all writer " #<" (str obj) " >" )
8813
+ (let [name (.-name obj)
8814
+ name (if (or (nil? name) (gstring/isEmpty name))
8815
+ " Function"
8816
+ name)]
8817
+ (write-all writer " #object[" name " \" " (str obj) " \" ]" ))
8814
8818
8815
8819
(instance? js/Date obj)
8816
8820
(let [normalize (fn [n len]
@@ -8834,7 +8838,12 @@ reduces them without incurring seq initialization"
8834
8838
(implements? IPrintWithWriter obj)
8835
8839
(-pr-writer obj writer opts)
8836
8840
8837
- :else (write-all writer " #<" (str obj) " >" )))))
8841
+ :else
8842
+ (let [name (.. obj -constructor -name)
8843
+ name (if (or (nil? name) (gstring/isEmpty name))
8844
+ " Object"
8845
+ name)]
8846
+ (write-all writer " #object[" name " " (str obj) " ]" ))))))
8838
8847
8839
8848
(defn- pr-writer
8840
8849
" Prefer this to pr-seq, because it makes the printing function
@@ -9838,7 +9847,7 @@ Maps become Objects. Arbitrary keys are encoded to by key->js."
9838
9847
; ;; ExceptionInfo
9839
9848
9840
9849
(defn- pr-writer-ex-info [obj writer opts]
9841
- (-write writer " #ExceptionInfo {:message " )
9850
+ (-write writer " #error {:message " )
9842
9851
(pr-writer (.-message obj) writer opts)
9843
9852
(when (.-data obj)
9844
9853
(-write writer " , :data " )
Original file line number Diff line number Diff line change 2022
2022
(catch ExceptionInfo e
2023
2023
(ex-data e)))))
2024
2024
(is (instance? js/Error (ex-info " asdf" {:foo 1 })))
2025
- (is (= (pr-str (ex-info " abc" {:x 1 })) " #ExceptionInfo {:message \" abc\" , :data {:x 1}}" ))
2026
- (is (= (pr-str (ex-info " abc" {:x 1 } " def" )) " #ExceptionInfo {:message \" abc\" , :data {:x 1}, :cause \" def\" }" ))
2027
- (is (= (.toString (ex-info " abc" {:x 1 } " def" )) " #ExceptionInfo {:message \" abc\" , :data {:x 1}, :cause \" def\" }" ))
2028
- (is (= (str (ex-info " abc" {:x 1 } " def" )) " #ExceptionInfo {:message \" abc\" , :data {:x 1}, :cause \" def\" }" ))
2025
+ (is (= (pr-str (ex-info " abc" {:x 1 })) " #error {:message \" abc\" , :data {:x 1}}" ))
2026
+ (is (= (pr-str (ex-info " abc" {:x 1 } " def" )) " #error {:message \" abc\" , :data {:x 1}, :cause \" def\" }" ))
2027
+ (is (= (.toString (ex-info " abc" {:x 1 } " def" )) " #error {:message \" abc\" , :data {:x 1}, :cause \" def\" }" ))
2028
+ (is (= (str (ex-info " abc" {:x 1 } " def" )) " #error {:message \" abc\" , :data {:x 1}, :cause \" def\" }" ))
2029
2029
(is (not (instance? cljs.core.ExceptionInfo (js/Error. )))))
2030
2030
2031
2031
(deftest test-435
You can’t perform that action at this time.
0 commit comments