diff --git a/index.d.ts b/index.d.ts index bfc0bd3..a9f3a05 100644 --- a/index.d.ts +++ b/index.d.ts @@ -59,8 +59,10 @@ declare class ElectronStore = Record; } export = ElectronStore; diff --git a/index.js b/index.js index b41f091..aa85e01 100644 --- a/index.js +++ b/index.js @@ -73,8 +73,12 @@ class ElectronStore extends Conf { initDataListener(); } - openInEditor() { - shell.openPath(this.path); + async openInEditor() { + const error = await shell.openPath(this.path); + + if (error) { + throw new Error(error); + } } } diff --git a/index.test-d.ts b/index.test-d.ts index 029d533..8cb476e 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -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 diff --git a/readme.md b/readme.md index 8b36c85..fed6223 100644 --- a/readme.md +++ b/readme.md @@ -379,6 +379,8 @@ Get the path to the storage file. Open the storage file in the user's editor. +Returns a promise that resolves when the editor has been opened, or rejects if it failed to open. + ### initRenderer() Initializer to set up the required `ipc` communication channels for the module when a `Store` instance is not created in the main process and you are creating a `Store` instance in the Electron renderer process only.