|
58 | 58 | [repl-env st err opts] st) |
59 | 59 |
|
60 | 60 | (defn parse-file-line-column [flc] |
61 | | - (let [xs (string/split flc #":") |
62 | | - [pre [line column]] |
63 | | - (reduce |
64 | | - (fn [[pre post] [x i]] |
65 | | - (if (<= i 2) |
66 | | - [pre (conj post x)] |
67 | | - [(conj pre x) post])) |
68 | | - [[] []] (map vector xs (range (count xs) 0 -1))) |
69 | | - file (string/join ":" pre)] |
70 | | - [(cond-> file |
71 | | - (starts-with? file "(") (string/replace "(" "")) |
72 | | - (parse-int |
73 | | - (cond-> line |
74 | | - (ends-with? line ")") (string/replace ")" ""))) |
75 | | - (parse-int |
76 | | - (cond-> column |
77 | | - (ends-with? column ")") (string/replace ")" "")))])) |
| 61 | + (if-not (re-find #":" flc) |
| 62 | + [flc nil nil] |
| 63 | + (let [xs (string/split flc #":") |
| 64 | + [pre [line column]] |
| 65 | + (reduce |
| 66 | + (fn [[pre post] [x i]] |
| 67 | + (if (<= i 2) |
| 68 | + [pre (conj post x)] |
| 69 | + [(conj pre x) post])) |
| 70 | + [[] []] (map vector xs (range (count xs) 0 -1))) |
| 71 | + file (string/join ":" pre)] |
| 72 | + [(cond-> file |
| 73 | + (starts-with? file "(") (string/replace "(" "")) |
| 74 | + (parse-int |
| 75 | + (cond-> line |
| 76 | + (ends-with? line ")") (string/replace ")" ""))) |
| 77 | + (parse-int |
| 78 | + (cond-> column |
| 79 | + (ends-with? column ")") (string/replace ")" "")))]))) |
78 | 80 |
|
79 | 81 | (defn parse-file |
80 | 82 | "Given a browser file url convert it into a relative path that can be used |
|
215 | 217 | [file line column] (parse-file-line-column flc)] |
216 | 218 | (if (and file function line column) |
217 | 219 | {:file (parse-file repl-env file opts) |
218 | | - :function function |
| 220 | + :function (string/trim function) |
219 | 221 | :line line |
220 | 222 | :column column} |
221 | 223 | (when-not (string/blank? function) |
|
244 | 246 | vec)) |
245 | 247 |
|
246 | 248 | (comment |
| 249 | + (parse-stacktrace {} |
| 250 | + "cljs$core$seq@out/cljs/core.js:3999:17 |
| 251 | + cljs$core$first@out/cljs/core.js:4018:22 |
| 252 | + cljs$core$ffirst@out/cljs/core.js:5161:39 |
| 253 | + global code" |
| 254 | + {:ua-product :safari} |
| 255 | + {:output-dir "out"}) |
| 256 | + |
247 | 257 | (parse-stacktrace {:host "localhost" :port 9000} |
248 | 258 | "cljs$core$seq@http://localhost:9000/out/cljs/core.js:4259:17 |
249 | 259 | cljs$core$first@http://localhost:9000/out/cljs/core.js:4289:22 |
|
0 commit comments