@lvce-editor/ports-view 0.8.1 → 0.10.0
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/portsViewWorkerMain.js +21 -4
- package/package.json +1 -1
|
@@ -615,6 +615,23 @@ const restoreMessageError = (error, _currentStack) => {
|
|
|
615
615
|
}
|
|
616
616
|
return restoredError;
|
|
617
617
|
};
|
|
618
|
+
const getFallbackMessage = error => {
|
|
619
|
+
if (error && typeof error.message === 'string' && error.message) {
|
|
620
|
+
return error.message;
|
|
621
|
+
}
|
|
622
|
+
if (error && error.data) {
|
|
623
|
+
return getFallbackMessage(error.data);
|
|
624
|
+
}
|
|
625
|
+
const stringified = String(error);
|
|
626
|
+
if (stringified !== '[object Object]') {
|
|
627
|
+
return stringified;
|
|
628
|
+
}
|
|
629
|
+
try {
|
|
630
|
+
return JSON.stringify(error);
|
|
631
|
+
} catch {
|
|
632
|
+
return stringified;
|
|
633
|
+
}
|
|
634
|
+
};
|
|
618
635
|
const restoreJsonRpcError = error => {
|
|
619
636
|
const currentStack = getCurrentStack();
|
|
620
637
|
if (error && error instanceof Error) {
|
|
@@ -623,13 +640,13 @@ const restoreJsonRpcError = error => {
|
|
|
623
640
|
if (error && error.code && error.code === MethodNotFound) {
|
|
624
641
|
return restoreMethodNotFoundError(error, currentStack);
|
|
625
642
|
}
|
|
643
|
+
if (error && error.error) {
|
|
644
|
+
return restoreJsonRpcError(error.error);
|
|
645
|
+
}
|
|
626
646
|
if (error && error.message) {
|
|
627
647
|
return restoreMessageError(error);
|
|
628
648
|
}
|
|
629
|
-
|
|
630
|
-
return new Error(`JsonRpc Error: ${error}`);
|
|
631
|
-
}
|
|
632
|
-
return new Error(`JsonRpc Error: ${error}`);
|
|
649
|
+
return new Error(`JsonRpc Error: ${getFallbackMessage(error)}`);
|
|
633
650
|
};
|
|
634
651
|
const unwrapJsonRpcResult = responseMessage => {
|
|
635
652
|
if ('error' in responseMessage) {
|