@lvce-editor/about-view 7.29.0 → 7.31.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.
@@ -666,6 +666,23 @@ const restoreMessageError = (error, _currentStack) => {
666
666
  }
667
667
  return restoredError;
668
668
  };
669
+ const getFallbackMessage = error => {
670
+ if (error && typeof error.message === 'string' && error.message) {
671
+ return error.message;
672
+ }
673
+ if (error && error.data) {
674
+ return getFallbackMessage(error.data);
675
+ }
676
+ const stringified = String(error);
677
+ if (stringified !== '[object Object]') {
678
+ return stringified;
679
+ }
680
+ try {
681
+ return JSON.stringify(error);
682
+ } catch {
683
+ return stringified;
684
+ }
685
+ };
669
686
  const restoreJsonRpcError = error => {
670
687
  const currentStack = getCurrentStack();
671
688
  if (error && error instanceof Error) {
@@ -674,13 +691,13 @@ const restoreJsonRpcError = error => {
674
691
  if (error && error.code && error.code === MethodNotFound) {
675
692
  return restoreMethodNotFoundError(error, currentStack);
676
693
  }
694
+ if (error && error.error) {
695
+ return restoreJsonRpcError(error.error);
696
+ }
677
697
  if (error && error.message) {
678
698
  return restoreMessageError(error);
679
699
  }
680
- if (typeof error === 'string') {
681
- return new Error(`JsonRpc Error: ${error}`);
682
- }
683
- return new Error(`JsonRpc Error: ${error}`);
700
+ return new Error(`JsonRpc Error: ${getFallbackMessage(error)}`);
684
701
  };
685
702
  const unwrapJsonRpcResult = responseMessage => {
686
703
  if ('error' in responseMessage) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/about-view",
3
- "version": "7.29.0",
3
+ "version": "7.31.0",
4
4
  "description": "About View Worker",
5
5
  "keywords": [
6
6
  "about-view"