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 <[email protected]>
This commit is contained in:
1 parent
30199ae5e5
commit
f42b2937fe
2 files changed
+9
-11
No files matched your search
@@ -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)) {
|
||||
|
||||
@@ -6,7 +6,7 @@ export class SshHostDiscoveryError extends Schema.TaggedErrorClass<SshHostDiscov
|
||||
"SshHostDiscoveryError",
|
||||
{
|
||||
message: Schema.String,
|
||||
cause: Schema.Defect,
|
||||
cause: Schema.Defect(),
|
||||
},
|
||||
) {}
|
||||
|
||||
@@ -23,19 +23,19 @@ export class SshCommandError extends Schema.TaggedErrorClass<SshCommandError>()(
|
||||
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>()("SshLaunchError", {
|
||||
message: Schema.String,
|
||||
stdout: Schema.String,
|
||||
cause: Schema.optional(Schema.Defect),
|
||||
cause: Schema.optional(Schema.Defect()),
|
||||
}) {}
|
||||
|
||||
export class SshPairingError extends Schema.TaggedErrorClass<SshPairingError>()("SshPairingError", {
|
||||
message: Schema.String,
|
||||
stdout: Schema.String,
|
||||
cause: Schema.optional(Schema.Defect),
|
||||
cause: Schema.optional(Schema.Defect()),
|
||||
}) {}
|
||||
|
||||
export class SshHttpBridgeError extends Schema.TaggedErrorClass<SshHttpBridgeError>()(
|
||||
@@ -43,7 +43,7 @@ export class SshHttpBridgeError extends Schema.TaggedErrorClass<SshHttpBridgeErr
|
||||
{
|
||||
message: Schema.String,
|
||||
status: Schema.optional(Schema.Number),
|
||||
cause: Schema.optional(Schema.Defect),
|
||||
cause: Schema.optional(Schema.Defect()),
|
||||
},
|
||||
) {}
|
||||
|
||||
@@ -51,7 +51,7 @@ export class SshReadinessError extends Schema.TaggedErrorClass<SshReadinessError
|
||||
"SshReadinessError",
|
||||
{
|
||||
message: Schema.String,
|
||||
cause: Schema.optional(Schema.Defect),
|
||||
cause: Schema.optional(Schema.Defect()),
|
||||
},
|
||||
) {}
|
||||
|
||||
@@ -59,7 +59,7 @@ export class SshPasswordPromptError extends Schema.TaggedErrorClass<SshPasswordP
|
||||
"SshPasswordPromptError",
|
||||
{
|
||||
message: Schema.String,
|
||||
cause: Schema.optional(Schema.Defect),
|
||||
cause: Schema.optional(Schema.Defect()),
|
||||
},
|
||||
) {}
|
||||
|
||||
|
||||
Reference in new issue
Block a user