MCPcopy Create free account
hub / github.com/OperationT00/T-Code / runtimeApiError

Function runtimeApiError

clients/t-code-cli/src/runtime-client.ts:96–112  ·  view source on GitHub ↗
(response: Response)

Source from the content-addressed store, hash-verified

94}
95
96async function runtimeApiError(response: Response): Promise<RuntimeApiError> {
97 const text = await response.text();
98 try {
99 const body = JSON.parse(text) as { error?: unknown };
100 if (typeof body.error === "string") {
101 return new RuntimeApiError(response.status, body.error, body.error);
102 }
103 if (isRecord(body.error)) {
104 const code = typeof body.error.code === "string" ? body.error.code : "unknown_error";
105 const message = typeof body.error.message === "string" ? body.error.message : code;
106 return new RuntimeApiError(response.status, code, message);
107 }
108 } catch {
109 // Preserve useful server text when a non-conforming response reaches the client.
110 }
111 return new RuntimeApiError(response.status, "unknown_error", text || response.statusText);
112}
113
114export function parseSse(body: string): RuntimeEvent[] {
115 return body

Callers 2

eventsMethod · 0.85
requestJsonMethod · 0.85

Calls 3

isRecordFunction · 0.85
textMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected