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

Function readApiErrorMessage

packages/oauth/src/api-error.ts:44–56  ·  view source on GitHub ↗
(
  response: Response,
  fallback: string,
)

Source from the content-addressed store, hash-verified

42}
43
44export async function readApiErrorMessage(
45 response: Response,
46 fallback: string,
47): Promise<string> {
48 let parsed: unknown;
49 try {
50 parsed = await response.json();
51 } catch {
52 return fallback;
53 }
54
55 return extractApiErrorMessage(parsed) ?? fallback;
56}
57
58function stringField(record: Record<string, unknown>, key: string): string | undefined {
59 return nonEmptyString(record[key]);

Callers 6

postJsonFunction · 0.90
fetchManagedUsageFunction · 0.90
fetchCustomRegistryFunction · 0.90
fetchSubmitFeedbackFunction · 0.90
fetchOpenPlatformModelsFunction · 0.90

Calls 2

extractApiErrorMessageFunction · 0.85
jsonMethod · 0.80

Tested by

no test coverage detected