0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-10 11:22:40 +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'; 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; return brewsQuery;
}; };
// Function to find brews
const findBrews = async (req, res) => { const findBrews = async (req, res) => {
const title = req.query.title || ''; const title = req.query.title || '';
const author = req.query.author || ''; const author = req.query.author || '';
@@ -76,14 +76,10 @@ const findBrews = async (req, res) => {
}) })
.catch((error) => { .catch((error) => {
console.error(error); console.error(error);
res.status(500).json({ throw {...err, message: "Error finding brews in Vault search", HBErrorCode: '99'};
error: 'Error finding brews in Vault search',
HBErrorCode: '99',
});
}); });
}; };
// Function to find total brews
const findTotal = async (req, res) => { const findTotal = async (req, res) => {
const title = req.query.title || ''; const title = req.query.title || '';
const author = req.query.author || ''; const author = req.query.author || '';
@@ -113,10 +109,7 @@ const findTotal = async (req, res) => {
}) })
.catch((error) => { .catch((error) => {
console.error(error); console.error(error);
res.status(500).json({ throw {...err, message: "Error finding brews in Vault search", HBErrorCode: '99'};
error: 'Error finding brews in Vault search find total search',
HBErrorCode: '99',
});
}); });
}; };