fix: preserve upstream model errors and native request parameters
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@ export async function api<T>(path: string, input?: unknown,method?:string): Prom
|
||||
...(input === undefined ? {} : { body: JSON.stringify(input) }),
|
||||
});
|
||||
const body = await response.json();
|
||||
if (!response.ok) throw new Error(body.error || '请求失败,请重试。');
|
||||
if (!response.ok) throw Object.assign(new Error(body.error || '请求失败,请重试。'), { status: response.status, diagnostic: body.diagnostic ?? null });
|
||||
return body as T;
|
||||
}
|
||||
export async function exportSession(id: string) {
|
||||
|
||||
Reference in New Issue
Block a user