MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / extractApiErrorBody

Function extractApiErrorBody

apps/ui/src/lib/api/openapi.ts:211–225  ·  view source on GitHub ↗
(raw: unknown)

Source from the content-addressed store, hash-verified

209};
210
211const extractApiErrorBody = (raw: unknown): IApiErrorBody => {
212 if (typeof raw !== "object" || raw === null) {
213 return { message: "Unknown error" };
214 }
215
216 if ("error" in raw) {
217 const nested: unknown = raw.error;
218
219 if (typeof nested === "object" && nested !== null) {
220 return toErrorBody(nested);
221 }
222 }
223
224 return toErrorBody(raw);
225};
226
227const throwOnError: Middleware = {
228 onResponse: async ({ response }) => {

Callers 1

openapi.tsFile · 0.85

Calls 1

toErrorBodyFunction · 0.85

Tested by

no test coverage detected