Errors
SSHKitError
public struct SSHKitError: Error, Equatable, LocalizedError, Sendable {
public var code: Int
public var message: String
public init(code: Int, message: String)
public var errorDescription: String? { get }
}
public typealias SSHError = SSHKitError
code is an Int, not the enum, so unknown bridged errors from Obj-C still round-trip. Compare against SSHKitErrorCode.X.rawValue when you need to branch.
SSHKitErrorCode
| Code | Case | Meaning |
|---|---|---|
| 1 | unavailable | Operation completed without a result, or feature is unsupported. |
| 2 | invalidState | Caller passed invalid input or violated the connection state machine. |
| 3 | connectionFailed | TCP, proxy, or libssh transport setup failed. |
| 4 | authenticationFailed | Server rejected the supplied credentials. |
| 5 | commandFailed | Streamed channel / SCP protocol broke. Not used for command non-zero exit — that is reported via SSHCommandResult.exitStatus. |
| 6 | hostKeyVerificationFailed | Host key did not match the active SSHHostKeyPolicy. |
| 7 | cancelled | Operation was cancelled via Task cancellation or close(). |
| 8 | sftpFailure | Generic SFTP failure not covered by the cases below. |
| 9 | sftpFileNotFound | SFTP server returned a "no such file" status. |
| 10 | sftpPermissionDenied | SFTP server returned a permission-denied status. |
| 11 | sftpNoSpace | SFTP server returned a no-space status. |