@jsenv/plugin-supervisor 1.4.6 → 1.4.8
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/dist/js/supervisor.js +17 -4
- package/package.json +1 -1
- package/src/client/supervisor.js +16 -4
package/dist/js/supervisor.js
CHANGED
|
@@ -530,7 +530,7 @@ window.__supervisor__ = (() => {
|
|
|
530
530
|
}
|
|
531
531
|
// isError can be false when reason is an ErrorEvent for instance
|
|
532
532
|
exception.isError = reason instanceof Error;
|
|
533
|
-
exception.name = reason
|
|
533
|
+
exception.name = getErrorName(reason);
|
|
534
534
|
exception.message = reason.message || message || "";
|
|
535
535
|
let stackFrames;
|
|
536
536
|
if (exception.isError && Error.captureStackTrace &&
|
|
@@ -599,7 +599,7 @@ window.__supervisor__ = (() => {
|
|
|
599
599
|
}
|
|
600
600
|
exception.stackTrace = stackTrace;
|
|
601
601
|
let stack = "";
|
|
602
|
-
const name = reason
|
|
602
|
+
const name = getErrorName(reason);
|
|
603
603
|
const message = reason.message || "";
|
|
604
604
|
stack += "".concat(name, ": ").concat(message);
|
|
605
605
|
if (stackTrace) {
|
|
@@ -777,7 +777,8 @@ window.__supervisor__ = (() => {
|
|
|
777
777
|
const getErrorStackTrace = error => {
|
|
778
778
|
let stack = error.stack;
|
|
779
779
|
if (!stack) return "";
|
|
780
|
-
const
|
|
780
|
+
const name = getErrorName(error);
|
|
781
|
+
const messageInStack = "".concat(name, ": ").concat(error.message);
|
|
781
782
|
if (stack.startsWith(messageInStack)) {
|
|
782
783
|
stack = stack.slice(messageInStack.length);
|
|
783
784
|
}
|
|
@@ -931,7 +932,7 @@ window.__supervisor__ = (() => {
|
|
|
931
932
|
});
|
|
932
933
|
if (cause) {
|
|
933
934
|
const causeText = stringifyStack({
|
|
934
|
-
name: cause
|
|
935
|
+
name: getErrorName(cause),
|
|
935
936
|
message: cause.reason ? generateClickableText(cause.reason) : cause.stack ? generateClickableText(cause.stack) : ""
|
|
936
937
|
});
|
|
937
938
|
if (causeText) {
|
|
@@ -1179,5 +1180,17 @@ window.__supervisor__ = (() => {
|
|
|
1179
1180
|
});
|
|
1180
1181
|
});
|
|
1181
1182
|
};
|
|
1183
|
+
const getErrorName = value => {
|
|
1184
|
+
const {
|
|
1185
|
+
constructor
|
|
1186
|
+
} = value;
|
|
1187
|
+
if (constructor === "Object") {
|
|
1188
|
+
return value.name || "Error";
|
|
1189
|
+
}
|
|
1190
|
+
if (constructor) {
|
|
1191
|
+
return constructor.name;
|
|
1192
|
+
}
|
|
1193
|
+
return value.name || "Error";
|
|
1194
|
+
};
|
|
1182
1195
|
return supervisor;
|
|
1183
1196
|
})();
|
package/package.json
CHANGED
package/src/client/supervisor.js
CHANGED
|
@@ -485,7 +485,7 @@ window.__supervisor__ = (() => {
|
|
|
485
485
|
}
|
|
486
486
|
// isError can be false when reason is an ErrorEvent for instance
|
|
487
487
|
exception.isError = reason instanceof Error;
|
|
488
|
-
exception.name = reason
|
|
488
|
+
exception.name = getErrorName(reason);
|
|
489
489
|
exception.message = reason.message || message || "";
|
|
490
490
|
|
|
491
491
|
let stackFrames;
|
|
@@ -557,7 +557,7 @@ window.__supervisor__ = (() => {
|
|
|
557
557
|
exception.stackTrace = stackTrace;
|
|
558
558
|
|
|
559
559
|
let stack = "";
|
|
560
|
-
const name = reason
|
|
560
|
+
const name = getErrorName(reason);
|
|
561
561
|
const message = reason.message || "";
|
|
562
562
|
stack += `${name}: ${message}`;
|
|
563
563
|
if (stackTrace) {
|
|
@@ -745,7 +745,8 @@ window.__supervisor__ = (() => {
|
|
|
745
745
|
const getErrorStackTrace = (error) => {
|
|
746
746
|
let stack = error.stack;
|
|
747
747
|
if (!stack) return "";
|
|
748
|
-
const
|
|
748
|
+
const name = getErrorName(error);
|
|
749
|
+
const messageInStack = `${name}: ${error.message}`;
|
|
749
750
|
if (stack.startsWith(messageInStack)) {
|
|
750
751
|
stack = stack.slice(messageInStack.length);
|
|
751
752
|
}
|
|
@@ -923,7 +924,7 @@ window.__supervisor__ = (() => {
|
|
|
923
924
|
});
|
|
924
925
|
if (cause) {
|
|
925
926
|
const causeText = stringifyStack({
|
|
926
|
-
name: cause
|
|
927
|
+
name: getErrorName(cause),
|
|
927
928
|
message: cause.reason
|
|
928
929
|
? generateClickableText(cause.reason)
|
|
929
930
|
: cause.stack
|
|
@@ -1260,5 +1261,16 @@ window.__supervisor__ = (() => {
|
|
|
1260
1261
|
});
|
|
1261
1262
|
};
|
|
1262
1263
|
|
|
1264
|
+
const getErrorName = (value) => {
|
|
1265
|
+
const { constructor } = value;
|
|
1266
|
+
if (constructor === "Object") {
|
|
1267
|
+
return value.name || "Error";
|
|
1268
|
+
}
|
|
1269
|
+
if (constructor) {
|
|
1270
|
+
return constructor.name;
|
|
1271
|
+
}
|
|
1272
|
+
return value.name || "Error";
|
|
1273
|
+
};
|
|
1274
|
+
|
|
1263
1275
|
return supervisor;
|
|
1264
1276
|
})();
|