0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 16:22:44 +00:00

bring back throws

This commit is contained in:
Víctor Losada Hernández
2024-08-31 22:34:04 +02:00
parent fb8c4c5c44
commit df21f978df

View File

@@ -28,10 +28,10 @@ const buildRendererConditions = (legacy, v3) => {
brewsQuery.renderer = 'V3';
}
//if all renderers are selected, doesn't make sense to add them to the query, it would only take longer
return brewsQuery;
};
// Function to find brews
const findBrews = async (req, res) => {
const title = req.query.title || '';
const author = req.query.author || '';
@@ -76,14 +76,10 @@ const findBrews = async (req, res) => {
})
.catch((error) => {
console.error(error);
res.status(500).json({
error: 'Error finding brews in Vault search',
HBErrorCode: '99',
});
throw {...err, message: "Error finding brews in Vault search", HBErrorCode: '99'};
});
};
// Function to find total brews
const findTotal = async (req, res) => {
const title = req.query.title || '';
const author = req.query.author || '';
@@ -113,10 +109,7 @@ const findTotal = async (req, res) => {
})
.catch((error) => {
console.error(error);
res.status(500).json({
error: 'Error finding brews in Vault search find total search',
HBErrorCode: '99',
});
throw {...err, message: "Error finding brews in Vault search", HBErrorCode: '99'};
});
};