Skip to content

Commit

Permalink
bare minimum error handling improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
cubeghost committed Feb 20, 2024
1 parent b17dda3 commit f5ba4bd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/server/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ apiRouter.post('/find', function(req, res, next) {
.then(result => res.json(result))
.catch(error => next(error));
} else {
res.status(400).send('POST body must include "blog" and "find"');
res.status(400).json({ message: 'POST body must include "blog" and "find"' });
}
});

Expand All @@ -83,7 +83,7 @@ apiRouter.post('/replace', function(req, res, next) {
.then(result => res.json(result))
.catch(error => next(error));
} else {
res.status(400).send('POST body must include "blog", "find", and "replace"');
res.status(400).json({ message: 'POST body must include "blog", "find", and "replace"' });
}
});

Expand All @@ -101,7 +101,7 @@ apiRouter.use(function(error, req, res, next) {
originalUrl: req.originalUrl,
}
});
res.status(500).send(error);
res.status(500).json({ message: error.message });
});


Expand Down

0 comments on commit f5ba4bd

Please sign in to comment.