use class variable to identify custom error

This commit is contained in:
Dave Simpson 2025-04-04 22:52:55 +02:00
parent e36f393682
commit 9c80246603

View File

@ -329,7 +329,10 @@ export class ElectronMainApplication extends TheiaElectronMainApplication {
// 2. A short timeout resolves the promise automatically, falling back to the usual app launch // 2. A short timeout resolves the promise automatically, falling back to the usual app launch
await this.openFilePromise.promise; await this.openFilePromise.promise;
} catch (err) { } catch (err) {
if (err instanceof InterruptWorkspaceRestoreError) { if (
err &&
(err as InterruptWorkspaceRestoreError).isInterruptWorkspaceRestoreError
) {
// Application has received the `open-file` event and will skip the default application launch // Application has received the `open-file` event and will skip the default application launch
return; return;
} }
@ -804,6 +807,8 @@ export class ElectronMainApplication extends TheiaElectronMainApplication {
} }
class InterruptWorkspaceRestoreError extends Error { class InterruptWorkspaceRestoreError extends Error {
public readonly isInterruptWorkspaceRestoreError = true;
constructor() { constructor() {
super( super(
"Received 'open-file' event. Interrupting the default launch workflow." "Received 'open-file' event. Interrupting the default launch workflow."