MCPcopy Create free account
hub / github.com/F12FLASH/CTF / throwIfResNotOk

Function throwIfResNotOk

4.Stackless Stack/client/src/lib/queryClient.ts:3–8  ·  view source on GitHub ↗
(res: Response)

Source from the content-addressed store, hash-verified

1import { QueryClient, QueryFunction } from "@tanstack/react-query";
2
3async function throwIfResNotOk(res: Response) {
4 if (!res.ok) {
5 const text = (await res.text()) || res.statusText;
6 throw new Error(`${res.status}: ${text}`);
7 }
8}
9
10export async function apiRequest(
11 method: string,

Callers 2

apiRequestFunction · 0.70
getQueryFnFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected