正在显示
2 个修改的文件
包含
6 行增加
和
2 行删除
... | ... | @@ -17,7 +17,11 @@ exports = module.exports = function(logger, settings) { |
17 | 17 | if (!_.isString(err.message)) |
18 | 18 | err.message = 'An unknown error has occured, please try again' |
19 | 19 | |
20 | + if (_.isString(err.name) && err.name === 'AuthenticationError') | |
21 | + err.message = 'Invalid login attempt, please try again' | |
22 | + | |
20 | 23 | if (_.isObject(err) && _.isNumber(err.code) && err.code === 11000) { |
24 | + | |
21 | 25 | // <https://github.com/LearnBoost/mongoose/issues/2129> |
22 | 26 | var field = err.message.split('index: ')[1].split('.$')[1] |
23 | 27 | // now we have `email_1 dup key` |
... | ... | @@ -55,7 +59,7 @@ exports = module.exports = function(logger, settings) { |
55 | 59 | } |
56 | 60 | |
57 | 61 | // set status code for BadRequestError |
58 | - if (_.isString(error.name) && error.name === 'BadRequestError') { | |
62 | + if (_.isString(err.name) && err.name === 'BadRequestError') { | |
59 | 63 | error.type = 'invalid_request_error' |
60 | 64 | res.statusCode = 400 |
61 | 65 | delete error.name | ... | ... |
请
注册
或
登录
后发表评论