fix(tiktok): preserve initialization error details
This commit is contained in:
@@ -296,8 +296,12 @@ async function publishTiktok(upload: typeof videoUploads.$inferSelect) {
|
||||
}),
|
||||
},
|
||||
);
|
||||
if (!init.ok)
|
||||
throw new Error(`TikTok upload initialization failed (${init.status}).`);
|
||||
if (!init.ok) {
|
||||
const detail = await init.text().catch(() => "");
|
||||
throw new Error(
|
||||
`TikTok upload initialization failed (${init.status})${detail ? `: ${detail}` : "."}`,
|
||||
);
|
||||
}
|
||||
const initData = (await init.json()) as {
|
||||
data?: { publish_id?: string; upload_url?: string };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user