File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 18
18
(defn throw-reader
19
19
" Throw reader exception, including line line/column."
20
20
[#?(:cljs ^:not-native reader :default reader) fmt & data]
21
- (let [c (r/get-column-number reader)
21
+ (let [m (apply interop/simple-format fmt data)
22
+ c (r/get-column-number reader)
22
23
l (r/get-line-number reader)]
23
24
(throw
24
25
(ex-info
25
- (str (apply interop/simple-format fmt data)
26
- " [at line " l " , column " c " ]" ) {}))))
26
+ (str m " [at line " l " , column " c " ]" )
27
+ {:msg m
28
+ :row l
29
+ :col c}))))
27
30
28
31
; ; ## Decisions
29
32
Original file line number Diff line number Diff line change 554
554
(is (= [1 1 ] start-pos))
555
555
(is (= [3 5 ] end-pos))))
556
556
557
-
558
557
(deftest t-os-specific-line-endings
559
558
(are [?in ?expected]
560
559
(let [str-actual (-> ?in p/parse-string-all node/string)]
585
584
; 1 2 3 4 5 6 7
586
585
" \r\n\r\r\f\r\n\r\r\n\r "
587
586
" \n\n\n\n\n\n\n " ))
587
+
588
+ (deftest t-position-in-ex-data
589
+ (let [ex (try (p/parse-string " (defn foo [)" )
590
+ (catch #?(:clj Exception :cljs :default ) e e))]
591
+ (is (= 1 (-> ex ex-data :row )))
592
+ (is (= 12 (-> ex ex-data :col )))))
You can’t perform that action at this time.
0 commit comments