Throw on bad argument to res.status()

TypeError: Cannot read property 'toString' of undefined
    at ServerResponse.writeHead (_http_server.js:205:44)
    at ServerResponse.writeHead (/Users/altitudelabs/Documents/Altitude_Labs/lynk-mobileapi/node_modules/compression/node_modules/on-headers/index.js:53:19)
    at ServerResponse._implicitHeader (_http_server.js:172:8)
    at ServerResponse.res.write (/Users/altitudelabs/Documents/Altitude_Labs/lynk-mobileapi/node_modules/compression/index.js:90:14)
    at ServerResponse.res.end (/Users/altitudelabs/Documents/Altitude_Labs/lynk-mobileapi/node_modules/compression/index.js:111:14)
    at ServerResponse.res.send (/Users/altitudelabs/Documents/Altitude_Labs/lynk-mobileapi/node_modules/express/lib/response.js:150:8)
    at ServerResponse.res.json (/Users/altitudelabs/Documents/Altitude_Labs/lynk-mobileapi/node_modules/express/lib/response.js:191:15)

This error message prompted me to inspect the variable I passed in res.json instead of res.statusCode

express@4.0.0

Author: Fantashit

1 thought on “Throw on bad argument to res.status()

Comments are closed.