MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / getApiErrorMessage

Function getApiErrorMessage

src/utils/api-error-message.ts:24–38  ·  view source on GitHub ↗
(error: unknown, fallback: string)

Source from the content-addressed store, hash-verified

22 * then `fallback`.
23 */
24export function getApiErrorMessage(error: unknown, fallback: string): string {
25 const body = getApiErrorBody(error);
26
27 if (body && typeof body === "object") {
28 const { message, detail } = body as {
29 message?: unknown;
30 detail?: unknown;
31 };
32 if (typeof message === "string" && message) return message;
33 if (typeof detail === "string" && detail) return detail;
34 }
35
36 if (error instanceof Error && error.message) return error.message;
37 return fallback;
38}

Callers 5

handleSubmitFunction · 0.90
handleRunNowFunction · 0.90
handleRunNowFunction · 0.90
handleImportConfirmFunction · 0.90

Calls 1

getApiErrorBodyFunction · 0.85

Tested by

no test coverage detected