From f42b2937fedf3a520f4dcf3f1b2d8abf8637e627 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 5 Jun 2026 19:18:24 +0000 Subject: [PATCH] fix: update Schema.Defect to function call and replace instanceof with Schema.is guard After rebase on main, the SSH error schema definitions needed updating: - Schema.Defect must be called as Schema.Defect() (function invocation) - Added stdout field to SshCommandError schema to match main's error construction - Replaced instanceof SshHttpBridgeError with Schema.is guard in desktop IPC Co-authored-by: Julius Marminge --- apps/desktop/src/ipc/methods/sshEnvironment.ts | 6 ++---- packages/ssh/src/errors.ts | 14 +++++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/apps/desktop/src/ipc/methods/sshEnvironment.ts b/apps/desktop/src/ipc/methods/sshEnvironment.ts index 6eeaa3202d..f005daf5c9 100644 --- a/apps/desktop/src/ipc/methods/sshEnvironment.ts +++ b/apps/desktop/src/ipc/methods/sshEnvironment.ts @@ -50,12 +50,10 @@ const isEnvironmentInternalError = Schema.is(EnvironmentInternalError); const isEnvironmentOperationForbiddenError = Schema.is(EnvironmentOperationForbiddenError); const isEnvironmentRequestInvalidError = Schema.is(EnvironmentRequestInvalidError); const isEnvironmentScopeRequiredError = Schema.is(EnvironmentScopeRequiredError); +const isSshHttpBridgeError = Schema.is(SshHttpBridgeError); function readSshHttpStatus(cause: DesktopSshEnvironmentRequestCause): number | null { - if ( - cause instanceof RemoteEnvironmentAuthUndeclaredStatusError || - cause instanceof SshHttpBridgeError - ) { + if (cause instanceof RemoteEnvironmentAuthUndeclaredStatusError || isSshHttpBridgeError(cause)) { return cause.status ?? null; } if (isEnvironmentRequestInvalidError(cause)) { diff --git a/packages/ssh/src/errors.ts b/packages/ssh/src/errors.ts index 8c8f369e53..51e17d8ccc 100644 --- a/packages/ssh/src/errors.ts +++ b/packages/ssh/src/errors.ts @@ -6,7 +6,7 @@ export class SshHostDiscoveryError extends Schema.TaggedErrorClass()( exitCode: Schema.NullOr(Schema.Number), stderr: Schema.String, stdout: Schema.optional(Schema.String), - cause: Schema.optional(Schema.Defect), + cause: Schema.optional(Schema.Defect()), }) {} export class SshLaunchError extends Schema.TaggedErrorClass()("SshLaunchError", { message: Schema.String, stdout: Schema.String, - cause: Schema.optional(Schema.Defect), + cause: Schema.optional(Schema.Defect()), }) {} export class SshPairingError extends Schema.TaggedErrorClass()("SshPairingError", { message: Schema.String, stdout: Schema.String, - cause: Schema.optional(Schema.Defect), + cause: Schema.optional(Schema.Defect()), }) {} export class SshHttpBridgeError extends Schema.TaggedErrorClass()( @@ -43,7 +43,7 @@ export class SshHttpBridgeError extends Schema.TaggedErrorClass