Skip to content

Commit

Permalink
.openInEditor throws
Browse files Browse the repository at this point in the history
  • Loading branch information
kiavashp committed Mar 5, 2024
1 parent 063b68f commit 9610075
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ class ElectronStore extends Conf {
initDataListener();
}

openInEditor() {
return shell.openPath(this.path);
async openInEditor() {
const error = await shell.openPath(this.path);

if (error) {
throw new Error(error);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ store.reset('foo');
store.has('foo');
store.clear();

store.openInEditor();
await store.openInEditor();

store.size; // eslint-disable-line @typescript-eslint/no-unused-expressions
store.store; // eslint-disable-line @typescript-eslint/no-unused-expressions
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ Get the path to the storage file.

Open the storage file in the user's editor.

See [`electron.shell.openPath(path)`](https://www.electronjs.org/docs/latest/api/shell#shellopenpathpath) for handling return value.
Will throw if the file failed to open.

### initRenderer()

Expand Down

0 comments on commit 9610075

Please sign in to comment.