@lvce-editor/title-bar-worker 4.25.5 → 4.25.6

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.
@@ -721,6 +721,23 @@ const restoreMessageError = (error, _currentStack) => {
721
721
  }
722
722
  return restoredError;
723
723
  };
724
+ const getFallbackMessage = error => {
725
+ if (error && typeof error.message === 'string' && error.message) {
726
+ return error.message;
727
+ }
728
+ if (error && error.data) {
729
+ return getFallbackMessage(error.data);
730
+ }
731
+ const stringified = String(error);
732
+ if (stringified !== '[object Object]') {
733
+ return stringified;
734
+ }
735
+ try {
736
+ return JSON.stringify(error);
737
+ } catch {
738
+ return stringified;
739
+ }
740
+ };
724
741
  const restoreJsonRpcError = error => {
725
742
  const currentStack = getCurrentStack();
726
743
  if (error && error instanceof Error) {
@@ -729,13 +746,13 @@ const restoreJsonRpcError = error => {
729
746
  if (error && error.code && error.code === MethodNotFound) {
730
747
  return restoreMethodNotFoundError(error, currentStack);
731
748
  }
749
+ if (error && error.error) {
750
+ return restoreJsonRpcError(error.error);
751
+ }
732
752
  if (error && error.message) {
733
753
  return restoreMessageError(error);
734
754
  }
735
- if (typeof error === 'string') {
736
- return new Error(`JsonRpc Error: ${error}`);
737
- }
738
- return new Error(`JsonRpc Error: ${error}`);
755
+ return new Error(`JsonRpc Error: ${getFallbackMessage(error)}`);
739
756
  };
740
757
  const unwrapJsonRpcResult = responseMessage => {
741
758
  if ('error' in responseMessage) {
@@ -2663,7 +2680,7 @@ const getSaveFlags = hasActiveTextEditor => {
2663
2680
  }
2664
2681
  return Disabled;
2665
2682
  };
2666
- const getMenuEntries$b = async (platform, autoSave$1, hasActiveTextEditor = false) => {
2683
+ const getMenuEntries$b = async (platform, autoSave$1, hasActiveTextEditor = false, hasOpenWorkspace = false) => {
2667
2684
  const autoSaveValue = autoSave$1 ?? (await getAutoSave());
2668
2685
  const saveFlags = getSaveFlags(hasActiveTextEditor);
2669
2686
  const entries = [{
@@ -2708,7 +2725,7 @@ const getMenuEntries$b = async (platform, autoSave$1, hasActiveTextEditor = fals
2708
2725
  label: autoSave()
2709
2726
  }, menuEntrySeparator, {
2710
2727
  command: 'Workspace.close',
2711
- flags: RestoreFocus,
2728
+ flags: hasOpenWorkspace ? RestoreFocus : Disabled,
2712
2729
  id: 'closeFolder',
2713
2730
  label: closeFolder()
2714
2731
  }];
@@ -3215,7 +3232,7 @@ const getMenuEntries2 = async (state, props) => {
3215
3232
  case Edit$2:
3216
3233
  return getMenuEntries$d();
3217
3234
  case File$3:
3218
- return getMenuEntries$b(props.platform, undefined, await hasOpenTextEditor());
3235
+ return getMenuEntries$b(props.platform, undefined, await hasOpenTextEditor(), Boolean(state.workspaceUri));
3219
3236
  case Go$2:
3220
3237
  return getMenuEntries$a();
3221
3238
  case Help$3:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/title-bar-worker",
3
- "version": "4.25.5",
3
+ "version": "4.25.6",
4
4
  "description": "Title Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",