fix unhandled exception (#473)

* handle error and return 400

* Update accounts.js

* Update accounts.js

* new test passing
This commit is contained in:
Sam Machin authored and GitHub committed 2025-06-26 13:09:42 -04:00
1 parent 1532a4ab9c
commit 781179bf0e
2 files changed
+19 -1

No files matched your search

+5 -1
View File
@@ -286,7 +286,11 @@ const hasAccountPermissions = async(req, res, next) => {
message: 'insufficient privileges'
});
} catch (error) {
throw error;
// return 400 on errors
res.status(400).json({
status: 'fail',
message: error.message
});
}
};