提交 1d96f4450d677c9124a86b7d08df1cad792fbb8b

作者 Nick Baugh
1 个父辈 772e8fff

Release 0.0.8

@@ -17,7 +17,11 @@ exports = module.exports = function(logger, settings) { @@ -17,7 +17,11 @@ exports = module.exports = function(logger, settings) {
17 if (!_.isString(err.message)) 17 if (!_.isString(err.message))
18 err.message = 'An unknown error has occured, please try again' 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 if (_.isObject(err) && _.isNumber(err.code) && err.code === 11000) { 23 if (_.isObject(err) && _.isNumber(err.code) && err.code === 11000) {
  24 +
21 // <https://github.com/LearnBoost/mongoose/issues/2129> 25 // <https://github.com/LearnBoost/mongoose/issues/2129>
22 var field = err.message.split('index: ')[1].split('.$')[1] 26 var field = err.message.split('index: ')[1].split('.$')[1]
23 // now we have `email_1 dup key` 27 // now we have `email_1 dup key`
@@ -55,7 +59,7 @@ exports = module.exports = function(logger, settings) { @@ -55,7 +59,7 @@ exports = module.exports = function(logger, settings) {
55 } 59 }
56 60
57 // set status code for BadRequestError 61 // set status code for BadRequestError
58 - if (_.isString(error.name) && error.name === 'BadRequestError') { 62 + if (_.isString(err.name) && err.name === 'BadRequestError') {
59 error.type = 'invalid_request_error' 63 error.type = 'invalid_request_error'
60 res.statusCode = 400 64 res.statusCode = 400
61 delete error.name 65 delete error.name
1 { 1 {
2 "name": "igloo", 2 "name": "igloo",
3 - "version": "0.0.7", 3 + "version": "0.0.8",
4 "description": "Igloo is a lightweight, fast, and minimal framework for rapid development", 4 "description": "Igloo is a lightweight, fast, and minimal framework for rapid development",
5 "main": "./lib", 5 "main": "./lib",
6 "engines": { 6 "engines": {
注册登录 后发表评论