Skip to content
Snippets Groups Projects
Commit de5bb966 authored by Louis-Marie Michelin's avatar Louis-Marie Michelin
Browse files

log error in catch

parent ed50c8ba
Branches
No related tags found
No related merge requests found
...@@ -21,6 +21,7 @@ router.post("/new", function (req, res) { ...@@ -21,6 +21,7 @@ router.post("/new", function (req, res) {
res.status(201).json(newDocument); res.status(201).json(newDocument);
}) })
.catch(function (error) { .catch(function (error) {
console.error(error);
if (error.code === 11000) { if (error.code === 11000) {
res.status(400).json({ res.status(400).json({
message: `User with email "${newUser.email}" already exists`, message: `User with email "${newUser.email}" already exists`,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment