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

Function sendMappedError

packages/server/src/routes/workspaceFs.ts:76–94  ·  view source on GitHub ↗
(
  reply: { send(payload: unknown): unknown },
  requestId: string,
  err: unknown,
)

Source from the content-addressed store, hash-verified

74}
75
76function sendMappedError(
77 reply: { send(payload: unknown): unknown },
78 requestId: string,
79 err: unknown,
80): void {
81 if (err instanceof WorkspaceFsNotAbsoluteError) {
82 reply.send(errEnvelope(ErrorCode.VALIDATION_FAILED, err.message, requestId));
83 return;
84 }
85 if (err instanceof WorkspaceFsNotFoundError) {
86 reply.send(errEnvelope(ErrorCode.FS_PATH_NOT_FOUND, err.message, requestId));
87 return;
88 }
89 if (err instanceof WorkspaceFsPermissionError) {
90 reply.send(errEnvelope(ErrorCode.FS_PERMISSION_DENIED, err.message, requestId));
91 return;
92 }
93 throw err;
94}

Callers 1

Calls 2

errEnvelopeFunction · 0.90
sendMethod · 0.65

Tested by

no test coverage detected