@lvce-editor/test-with-playwright-worker 22.38.6 → 22.39.1
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/coverageWorkerMain.js +24 -4
- package/dist/workerMain.js +24 -4
- package/package.json +1 -1
|
@@ -524,6 +524,23 @@ const restoreMessageError = (error, _currentStack) => {
|
|
|
524
524
|
}
|
|
525
525
|
return restoredError;
|
|
526
526
|
};
|
|
527
|
+
const getFallbackMessage = error => {
|
|
528
|
+
if (error && typeof error.message === 'string' && error.message) {
|
|
529
|
+
return error.message;
|
|
530
|
+
}
|
|
531
|
+
if (error && error.data) {
|
|
532
|
+
return getFallbackMessage(error.data);
|
|
533
|
+
}
|
|
534
|
+
const stringified = String(error);
|
|
535
|
+
if (stringified !== '[object Object]') {
|
|
536
|
+
return stringified;
|
|
537
|
+
}
|
|
538
|
+
try {
|
|
539
|
+
return JSON.stringify(error);
|
|
540
|
+
} catch {
|
|
541
|
+
return stringified;
|
|
542
|
+
}
|
|
543
|
+
};
|
|
527
544
|
const restoreJsonRpcError = error => {
|
|
528
545
|
const currentStack = getCurrentStack();
|
|
529
546
|
if (error && error instanceof Error) {
|
|
@@ -532,13 +549,13 @@ const restoreJsonRpcError = error => {
|
|
|
532
549
|
if (error && error.code && error.code === MethodNotFound) {
|
|
533
550
|
return restoreMethodNotFoundError(error, currentStack);
|
|
534
551
|
}
|
|
552
|
+
if (error && error.error) {
|
|
553
|
+
return restoreJsonRpcError(error.error);
|
|
554
|
+
}
|
|
535
555
|
if (error && error.message) {
|
|
536
556
|
return restoreMessageError(error);
|
|
537
557
|
}
|
|
538
|
-
|
|
539
|
-
return new Error(`JsonRpc Error: ${error}`);
|
|
540
|
-
}
|
|
541
|
-
return new Error(`JsonRpc Error: ${error}`);
|
|
558
|
+
return new Error(`JsonRpc Error: ${getFallbackMessage(error)}`);
|
|
542
559
|
};
|
|
543
560
|
const unwrapJsonRpcResult = responseMessage => {
|
|
544
561
|
if ('error' in responseMessage) {
|
|
@@ -819,6 +836,9 @@ const logError = () => {
|
|
|
819
836
|
// handled by renderer worker
|
|
820
837
|
};
|
|
821
838
|
const handleMessage = event => {
|
|
839
|
+
if (event.data === 'ready') {
|
|
840
|
+
return Promise.resolve();
|
|
841
|
+
}
|
|
822
842
|
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
823
843
|
const actualExecute = event?.target?.execute || execute;
|
|
824
844
|
return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
|
package/dist/workerMain.js
CHANGED
|
@@ -785,6 +785,23 @@ const restoreMessageError = (error, _currentStack) => {
|
|
|
785
785
|
}
|
|
786
786
|
return restoredError;
|
|
787
787
|
};
|
|
788
|
+
const getFallbackMessage = error => {
|
|
789
|
+
if (error && typeof error.message === 'string' && error.message) {
|
|
790
|
+
return error.message;
|
|
791
|
+
}
|
|
792
|
+
if (error && error.data) {
|
|
793
|
+
return getFallbackMessage(error.data);
|
|
794
|
+
}
|
|
795
|
+
const stringified = String(error);
|
|
796
|
+
if (stringified !== '[object Object]') {
|
|
797
|
+
return stringified;
|
|
798
|
+
}
|
|
799
|
+
try {
|
|
800
|
+
return JSON.stringify(error);
|
|
801
|
+
} catch {
|
|
802
|
+
return stringified;
|
|
803
|
+
}
|
|
804
|
+
};
|
|
788
805
|
const restoreJsonRpcError = error => {
|
|
789
806
|
const currentStack = getCurrentStack();
|
|
790
807
|
if (error && error instanceof Error) {
|
|
@@ -793,13 +810,13 @@ const restoreJsonRpcError = error => {
|
|
|
793
810
|
if (error && error.code && error.code === MethodNotFound) {
|
|
794
811
|
return restoreMethodNotFoundError(error, currentStack);
|
|
795
812
|
}
|
|
813
|
+
if (error && error.error) {
|
|
814
|
+
return restoreJsonRpcError(error.error);
|
|
815
|
+
}
|
|
796
816
|
if (error && error.message) {
|
|
797
817
|
return restoreMessageError(error);
|
|
798
818
|
}
|
|
799
|
-
|
|
800
|
-
return new Error(`JsonRpc Error: ${error}`);
|
|
801
|
-
}
|
|
802
|
-
return new Error(`JsonRpc Error: ${error}`);
|
|
819
|
+
return new Error(`JsonRpc Error: ${getFallbackMessage(error)}`);
|
|
803
820
|
};
|
|
804
821
|
const unwrapJsonRpcResult = responseMessage => {
|
|
805
822
|
if ('error' in responseMessage) {
|
|
@@ -1080,6 +1097,9 @@ const logError = () => {
|
|
|
1080
1097
|
// handled by renderer worker
|
|
1081
1098
|
};
|
|
1082
1099
|
const handleMessage = event => {
|
|
1100
|
+
if (event.data === 'ready') {
|
|
1101
|
+
return Promise.resolve();
|
|
1102
|
+
}
|
|
1083
1103
|
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
1084
1104
|
const actualExecute = event?.target?.execute || execute;
|
|
1085
1105
|
return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
|