mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-30 19:42:43 +00:00
fix notitle search and catch 404?
This commit is contained in:
@@ -41,7 +41,7 @@ const archive = {
|
||||
.maxTimeMS(5000)
|
||||
.exec();
|
||||
|
||||
const totalBrews = await HomebrewModel.countDocuments(titleQuery, projection);
|
||||
const totalBrews = await HomebrewModel.countDocuments(titleQuery, projection).maxTimeMS(5000);
|
||||
|
||||
const totalPages = Math.ceil(totalBrews / pageSize);
|
||||
//console.log('Total brews: ', totalBrews);
|
||||
@@ -49,10 +49,6 @@ const archive = {
|
||||
return res.json({ brews, page, totalPages, totalBrews});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
console.log(error);
|
||||
if (error.response && error.response.status === 404) {
|
||||
return res.status(404).json({ errorCode: '404', message: 'Brews not found' });
|
||||
}
|
||||
if (error.response && error.response.status === 503) {
|
||||
return res.status(503).json({ errorCode: '503', message: 'Service Unavailable' });
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user