Commit 5c931b69 authored by rlacko's avatar rlacko 💬
Browse files

fix error messages

parent f264306a
Pipeline #4718 failed with stages
in 1 minute and 55 seconds
......@@ -23,11 +23,10 @@ exports.default.getOne = async (req, res) => {
} catch (err) {
if (err.name === 'CastError') {
// Throwed by Mongoose
console.error(err)
return res.status(422).json({ message: 'Invalid ID provided' })
}
console.error(err)
res.status(400).end()
res.status(500).end()
}
}
exports.default.getMany = async (req, res) => {
......@@ -47,7 +46,7 @@ exports.default.getMany = async (req, res) => {
})
} catch (err) {
console.error(err)
return res.status(400).end()
return res.status(500).end()
}
}
exports.default.createOne = async (req, res) => {
......@@ -69,6 +68,6 @@ exports.default.createOne = async (req, res) => {
}
console.error(err)
return res.status(400).end()
return res.status(500).end()
}
}
......@@ -42,12 +42,11 @@ exports.default.getOne = async (req, res) => {
} catch (err) {
if (err.name === 'CastError') {
// Throwed by Mongoose
console.error(err)
return res.status(422).json({ message: 'Invalid ID provided' })
}
console.error(err)
res.status(400).end()
res.status(500).end()
}
}
exports.default.getMany = async (req, res) => {
......@@ -78,7 +77,7 @@ exports.default.getMany = async (req, res) => {
})
} catch (err) {
console.error(err)
res.status(400).end()
res.status(500).end()
}
}
exports.default.createOne = async (req, res) => {
......@@ -117,6 +116,6 @@ exports.default.createOne = async (req, res) => {
}
console.error(err)
return res.status(400).end()
return res.status(500).end()
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment