cozy / cozy-proxy

This repository was part of CozyV2 which has been deprecated - Cozy authentication and routing layer
https://blog.cozycloud.cc/post/2016/11/21/On-the-road-to-Cozy-version-3
GNU Affero General Public License v3.0
26 stars 31 forks source link

Add a missing error handler #225

Closed clochix closed 8 years ago

clochix commented 8 years ago

This should fix an exception saw in error logs:

Cannot read property 'username' of undefined
TypeError: Cannot read property 'username' of undefined
    at /usr/local/cozy/apps/proxy/build/server/controllers/authentication.js:110:13
    at /usr/local/cozy/apps/proxy/build/server/controllers/authentication.js:26:14
    at /usr/local/cozy/apps/proxy/build/server/models/user.js:77:14
    at /usr/local/cozy/apps/proxy/build/server/models/user.js:64:14
    at /usr/local/cozy/apps/proxy/node_modules/americano-cozy/node_modules/jugglingdb-cozy-adapter/lib/cozy_data_system.js:405:18
    at parseBody (/usr/local/cozy/apps/proxy/node_modules/americano-cozy/node_modules/jugglingdb-cozy-adapter/node_modules/request-json/main.js:26:12)
    at Request._callback (/usr/local/cozy/apps/proxy/node_modules/americano-cozy/node_modules/jugglingdb-cozy-adapter/node_modules/request-json/main.js:81:18)
    at Request.self.callback (/usr/local/cozy/apps/proxy/node_modules/americano-cozy/node_modules/jugglingdb-cozy-adapter/node_modules/request-json/node_modules/request/index.js:148:22)
    at Request.emit (events.js:98:17)
    at Request.<anonymous> (/usr/local/cozy/apps/proxy/node_modules/americano-cozy/node_modules/jugglingdb-cozy-adapter/node_modules/request-json/node_modules/request/index.js:876:14)