MCPcopy Create free account
hub / github.com/MemTensor/MemOS / rpcCodeForError

Function rpcCodeForError

apps/memos-local-plugin/agent-contract/jsonrpc.ts:128–140  ·  view source on GitHub ↗
(code: ErrorCode | undefined)

Source from the content-addressed store, hash-verified

126
127/** Map an internal `MemosError.code` to a numeric JSON-RPC code we'll report. */
128export function rpcCodeForError(code: ErrorCode | undefined): number {
129 if (!code) return JSONRPC_INTERNAL_ERROR;
130 switch (code) {
131 case "invalid_argument":
132 case "config_invalid":
133 case "protocol_error":
134 return JSONRPC_INVALID_PARAMS;
135 case "unknown_method":
136 return JSONRPC_METHOD_NOT_FOUND;
137 default:
138 return JSONRPC_APPLICATION_ERROR;
139 }
140}

Callers 2

handleLineFunction · 0.90
contract.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected