UNPKG

mcp-ssh-tool

Version:

Model Context Protocol (MCP) SSH client server for remote automation

60 lines 1.61 kB
import { ErrorCode, SSHMCPError } from './types.js'; /** * Creates an authentication error */ export function createAuthError(message, hint) { return new SSHMCPError(ErrorCode.EAUTH, message, hint); } /** * Creates a connection error */ export function createConnectionError(message, hint) { return new SSHMCPError(ErrorCode.ECONN, message, hint); } /** * Creates a timeout error */ export function createTimeoutError(message, hint) { return new SSHMCPError(ErrorCode.ETIMEOUT, message, hint); } /** * Creates a sudo error */ export function createSudoError(message, hint) { return new SSHMCPError(ErrorCode.ENOSUDO, message, hint); } /** * Creates a package manager error */ export function createPackageManagerError(message, hint) { return new SSHMCPError(ErrorCode.EPMGR, message, hint); } /** * Creates a filesystem error */ export function createFilesystemError(message, hint) { return new SSHMCPError(ErrorCode.EFS, message, hint); } /** * Creates a patch error */ export function createPatchError(message, hint) { return new SSHMCPError(ErrorCode.EPATCH, message, hint); } /** * Creates a bad request error */ export function createBadRequestError(message, hint) { return new SSHMCPError(ErrorCode.EBADREQ, message, hint); } /** * Wraps an unknown error into an SSH MCP error */ export function wrapError(error, code, hint) { if (error instanceof SSHMCPError) { return error; } const message = error instanceof Error ? error.message : String(error); return new SSHMCPError(code, message, hint); } //# sourceMappingURL=errors.js.map