提交 961c1943268757cda855567eee4fce09ed68a5ff

作者 Nick Baugh
1 个父辈 ec48f19c

refined error handler

正在显示 1 个修改的文件 包含 3 行增加1 行删除
@@ -14,8 +14,10 @@ exports = module.exports = function(logger, settings) { @@ -14,8 +14,10 @@ exports = module.exports = function(logger, settings) {
14 if (!_.isString(err.message)) 14 if (!_.isString(err.message))
15 err.message = 'An unknown error has occured, please try again' 15 err.message = 'An unknown error has occured, please try again'
16 16
17 - if (_.isObject(err) && _.isNumber(err.code) && err.code === 11000) 17 + if (_.isObject(err) && _.isNumber(err.code) && err.code === 11000) {
18 err.message = 'Duplicate document already exists in database, try making a more unique value' 18 err.message = 'Duplicate document already exists in database, try making a more unique value'
  19 + err.param = ''
  20 + }
19 21
20 // if we pass an error object, then we want to simply return the message... 22 // if we pass an error object, then we want to simply return the message...
21 // if we pass an object, then we want to do a stack trace, and then return the object + stack 23 // if we pass an object, then we want to do a stack trace, and then return the object + stack
注册登录 后发表评论