From 64242322a2a3b192da198f897381fa4e4c8b4a3e Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Mon, 2 Mar 2026 18:46:21 +0000 Subject: [PATCH] add try/catch block --- server/src/controllers/settingsController.ts | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/server/src/controllers/settingsController.ts b/server/src/controllers/settingsController.ts index 0dc0e5b07..d3caa0d8f 100644 --- a/server/src/controllers/settingsController.ts +++ b/server/src/controllers/settingsController.ts @@ -56,15 +56,19 @@ class SettingsController { }; updateAppSettings = async (req: Request, res: Response, next: NextFunction) => { - updateAppSettingsBodyValidation.parse(req.body); + try { + updateAppSettingsBodyValidation.parse(req.body); - const updatedSettings = await this.settingsService.updateDbSettings(req.body); - const returnSettings = this.buildAppSettings(updatedSettings); - return res.status(200).json({ - success: true, - msg: "App settings updated successfully", - data: returnSettings, - }); + const updatedSettings = await this.settingsService.updateDbSettings(req.body); + const returnSettings = this.buildAppSettings(updatedSettings); + return res.status(200).json({ + success: true, + msg: "App settings updated successfully", + data: returnSettings, + }); + } catch (error) { + next(error); + } }; sendTestEmail = async (req: Request, res: Response, next: NextFunction) => {