Feathersjs错误处理问题

时间:2017-06-30 14:26:31

标签: feathersjs

对featherjs-authentication有疑问。在没有Authorization标头的情况下调用需要授权的服务会在控制台中导致此堆栈跟踪:

    at Object.<anonymous> (/User Analytics/Backend/node_modules/feathers-
errors/lib/index.js:69:27)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/User Analytics/Backend/node_modules/feathers-
 rest/lib/wrappers.js:13:23)
at Module._compile (module.js:571:32)

客户收到更奇怪的回复:

    {
    "name": "GeneralError",
    "message": "`toJSON` takes 0 argument, 1 provided 
      after:\nr.db(\"user_analytics\").table(\"fbusers\")",
    "code": 500,
    "className": "general-error",
    "data": {},
    "errors": {}
}

客户端收到GeneralError而不是具体错误和正确的代码。 依赖包:

"dependencies": {
    "body-parser": "^1.17.2",
    "compression": "^1.6.2",
    "cors": "^2.8.3",
    "fb": "^2.0.0",
    "feathers": "^2.1.3",
    "feathers-authentication": "^1.2.6",
    "feathers-authentication-hooks": "^0.1.4",
    "feathers-authentication-jwt": "^0.3.1",
    "feathers-authentication-local": "^0.4.3",
    "feathers-configuration": "^0.4.1",
    "feathers-errors": "^2.8.1",
    "feathers-hooks": "^2.0.1",
    "feathers-hooks-common": "^3.5.5",
    "feathers-rest": "^1.7.3",
    "feathers-rethinkdb": "^0.4.3",
    "feathers-socketio": "^2.0.0",
    "helmet": "^3.6.1",
    "lodash": "^4.17.4",
    "node-rest-client": "^3.1.0",
    "rethinkdbdash": "^2.3.29",
    "serve-favicon": "^2.4.3",
    "winston": "^2.3.1"
},

0 个答案:

没有答案