chore: update request error message

This commit is contained in:
steven
2023-03-29 16:37:29 +08:00
parent ceaf64ee9e
commit e5bbec24a6
9 changed files with 71 additions and 33 deletions

View File

@ -23,10 +23,13 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
structure,
});
}
res.status(200).json(tableStructures);
} catch (error) {
res.status(200).json({
data: tableStructures,
});
} catch (error: any) {
res.status(400).json({
error: error,
message: error.message || "Failed to get database schema.",
code: error.code || "UNKNOWN",
});
}
};