MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / mapSftpError

Function mapSftpError

packages/kaos/src/ssh.ts:169–184  ·  view source on GitHub ↗
(operation: string, error: unknown)

Source from the content-addressed store, hash-verified

167}
168
169function mapSftpError(operation: string, error: unknown): KaosSSHError {
170 const code = getErrorCode(error);
171 const message = `${operation} failed: ${getErrorMessage(error)}`;
172 const statusCode = getSftpStatusCode();
173
174 if (code === statusCode.NO_SUCH_FILE) {
175 return new KaosFileNotFoundError(message, code);
176 }
177 if (code === statusCode.PERMISSION_DENIED) {
178 return new KaosPermissionError(message, code);
179 }
180 if (code === statusCode.NO_CONNECTION || code === statusCode.CONNECTION_LOST) {
181 return new KaosConnectionError(message, code);
182 }
183 return new KaosSSHError(message, code);
184}
185
186function buildAuthHandler(
187 username: string,

Callers 8

sftpRealpathFunction · 0.85
sftpStatFunction · 0.85
sftpLstatFunction · 0.85
sftpReaddirFunction · 0.85
sftpMkdirFunction · 0.85
sftpReadFileFunction · 0.85
sftpWriteFileFunction · 0.85
sftpAppendFileFunction · 0.85

Calls 3

getErrorMessageFunction · 0.85
getSftpStatusCodeFunction · 0.85
getErrorCodeFunction · 0.70

Tested by

no test coverage detected