From 62ca431cba40d2eb21e7e314f52500b226b8ec3e Mon Sep 17 00:00:00 2001 From: Dave Simpson <45690499+davegarthsimpson@users.noreply.github.com> Date: Fri, 4 Apr 2025 23:20:29 +0200 Subject: [PATCH] try object instead of error --- .../src/electron-main/theia/electron-main-application.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/arduino-ide-extension/src/electron-main/theia/electron-main-application.ts b/arduino-ide-extension/src/electron-main/theia/electron-main-application.ts index f5fa242a..1d9d22fd 100644 --- a/arduino-ide-extension/src/electron-main/theia/electron-main-application.ts +++ b/arduino-ide-extension/src/electron-main/theia/electron-main-application.ts @@ -291,7 +291,9 @@ export class ElectronMainApplication extends TheiaElectronMainApplication { true ); if (sketchFolderPath) { - this.openFilePromise.reject(new InterruptWorkspaceRestoreError()); + this.openFilePromise.reject({ + name: 'InterruptWorkspaceRestoreError', + }); await this.openSketch(sketchFolderPath); } } @@ -329,10 +331,7 @@ export class ElectronMainApplication extends TheiaElectronMainApplication { // 2. A short timeout resolves the promise automatically, falling back to the usual app launch await this.openFilePromise.promise; } catch (err) { - if ( - err && - (err as InterruptWorkspaceRestoreError).isInterruptWorkspaceRestoreError - ) { + if (err && (err as any).name === 'InterruptWorkspaceRestoreError') { // Application has received the `open-file` event and will skip the default application launch return; }