This commit is contained in:
NotII
2025-03-24 00:17:45 +00:00
parent c65511aa5d
commit 6566b427b0
2 changed files with 20 additions and 9 deletions

View File

@@ -21,6 +21,12 @@ export async function clientFetch<T = any>(url: string, options: RequestInit = {
if (!res.ok) {
const errorData = await res.json().catch(() => ({}));
const errorMessage = errorData.message || errorData.error || `Request failed: ${res.status} ${res.statusText}`;
console.error('API Error:', {
status: res.status,
url: fullUrl,
response: errorData,
method: options.method || 'GET'
});
throw new Error(errorMessage);
}