juxscript 1.1.158 → 1.1.159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/machinery/errors.js +22 -5
- package/package.json +1 -1
package/machinery/errors.js
CHANGED
|
@@ -15,12 +15,29 @@ export function generateErrorCollector(options = {}) {
|
|
|
15
15
|
|
|
16
16
|
function findSource(stack) {
|
|
17
17
|
var sources = window.__juxSources;
|
|
18
|
-
if (!sources
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
if (!sources) return null;
|
|
19
|
+
|
|
20
|
+
// Try matching renderJuxN anywhere in the stack
|
|
21
|
+
if (stack) {
|
|
22
|
+
var m = stack.match(/renderJux\\d+/g);
|
|
23
|
+
if (m) {
|
|
24
|
+
for (var i = 0; i < m.length; i++) {
|
|
25
|
+
for (var key in sources) {
|
|
26
|
+
if (sources[key].functionName === m[i]) return sources[key];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Fallback: if there's only one source, show it
|
|
33
|
+
var keys = Object.keys(sources);
|
|
34
|
+
if (keys.length === 1) return sources[keys[0]];
|
|
35
|
+
|
|
36
|
+
// Fallback: return first source that has a functionName
|
|
37
|
+
for (var k in sources) {
|
|
38
|
+
if (sources[k].functionName) return sources[k];
|
|
23
39
|
}
|
|
40
|
+
|
|
24
41
|
return null;
|
|
25
42
|
}
|
|
26
43
|
|