mirror of
https://github.com/hansputera/tiktok-dl.git
synced 2026-04-05 19:51:57 +02:00
feat(apps.web#download): creturn 400 http status code when ArgumentError occurred
Signed-off-by: hansputera <hanifdwyputrasembiring@gmail.com>
This commit is contained in:
@@ -56,8 +56,10 @@ export default async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
|
||||
return res.status(200).json(result);
|
||||
} catch (e) {
|
||||
return res.status(500).json({
|
||||
error: (e as Error).message,
|
||||
});
|
||||
return res
|
||||
.status((e as Error).name === 'ArgumentError' ? 400 : 500)
|
||||
.json({
|
||||
error: (e as Error).name + '|' + (e as Error).message,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user