Description
If the Stacks API returns a 200 with a non-JSON body (corrupted response, gateway HTML error page), response.json() will throw an unhandled SyntaxError. The error message gives no indication of what went wrong.
Location
src/fetcher.ts:47 — return (await response.json()) as ClarityAbi;
Suggested fix
Wrap in try/catch and re-throw with context:
try {
return (await response.json()) as ClarityAbi;
} catch (cause) {
throw new Error(
`Invalid JSON response for ${address}.${name} on ${network}`,
{ cause },
);
}
Description
If the Stacks API returns a 200 with a non-JSON body (corrupted response, gateway HTML error page),
response.json()will throw an unhandledSyntaxError. The error message gives no indication of what went wrong.Location
src/fetcher.ts:47—return (await response.json()) as ClarityAbi;Suggested fix
Wrap in try/catch and re-throw with context: