Skip to content

Commit bc6ecdd

Browse files
committed
CLJS-3017: Error->map: Map js/InternalError and js/TypeError
1 parent d64b233 commit bc6ecdd

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

src/main/cljs/cljs/repl.cljs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,7 @@
7373
(let [base (fn [t]
7474
(merge {:type (cond
7575
(instance? ExceptionInfo t) 'ExceptionInfo
76-
(instance? js/EvalError t) 'js/EvalError
77-
(instance? js/RangeError t) 'js/RangeError
78-
(instance? js/ReferenceError t) 'js/ReferenceError
79-
(instance? js/SyntaxError t) 'js/SyntaxError
80-
(instance? js/URIError t) 'js/URIError
81-
(instance? js/Error t) 'js/Error
76+
(instance? js/Error t) (symbol "js" (.-name t))
8277
:else nil)}
8378
(when-let [msg (ex-message t)]
8479
{:message msg})

src/test/cljs/cljs/repl_test.cljs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
; Copyright (c) Rich Hickey. All rights reserved.
2+
; The use and distribution terms for this software are covered by the
3+
; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4+
; which can be found in the file epl-v10.html at the root of this distribution.
5+
; By using this software in any fashion, you are agreeing to be bound by
6+
; the terms of this license.
7+
; You must not remove this notice, or any other, from this software.
8+
9+
(ns cljs.repl-test
10+
(:require
11+
[cljs.repl]
12+
[cljs.test :refer [deftest is]]))
13+
14+
(deftest test-cljs-3017
15+
(let [m (cljs.repl/Error->map (js/TypeError.))]
16+
(is (= 'js/TypeError (get-in m [:via 0 :type])))))

src/test/cljs/test_runner.cljs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
[cljs.array-access-test]
5252
[cljs.inference-test]
5353
[cljs.walk-test]
54+
[cljs.repl-test]
5455
[cljs.extend-to-native-test]))
5556

5657
(set! *print-newline* false)
@@ -100,4 +101,5 @@
100101
'cljs.array-access-test
101102
'cljs.inference-test
102103
'cljs.walk-test
104+
'cljs.repl-test
103105
'cljs.extend-to-native-test)

src/test/self/self_parity/test.cljs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@
176176
technical issues)."
177177
[name macros]
178178
((if macros
179-
#{'cljs.core}
179+
#{'cljs.core
180+
'cljs.repl}
180181
#{'goog.object
181182
'goog.string
182183
'goog.string.StringBuffer
@@ -315,6 +316,7 @@
315316
[cljs.array-access-test]
316317
[cljs.inference-test]
317318
[cljs.walk-test]
319+
[cljs.repl-test]
318320
[cljs.extend-to-native-test]))
319321
(fn [{:keys [value error]}]
320322
(if error
@@ -362,6 +364,7 @@
362364
'cljs.array-access-test
363365
'cljs.inference-test
364366
'cljs.walk-test
367+
'cljs.repl-test
365368
'cljs.extend-to-native-test)
366369
(fn [{:keys [value error]}]
367370
(when error

0 commit comments

Comments
 (0)