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

@ -15,8 +15,11 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const connector = newConnector(connection);
await connector.testConnection();
res.status(200).json({});
} catch (error) {
res.status(400).json({});
} catch (error: any) {
res.status(400).json({
message: error.message || "Failed to test connection.",
code: error.code || "UNKNOWN",
});
}
};