Reputation: 2464
I have been tasked with modifying a node.js app that uses express, that someone else created.
I need a way to throw all undefined variables in the app. there are thousands of functions and the app just hangs. From doing some initial debugging I have noticed that each issue I have come tackled is ultimately because of undefined variables.
I don't want to get into a long discussion about error handling in node.js/express, because I understand this, but the person who built the app did not.
I am just looking for a way to throw all undefined variables to help me find them in the code and fix the issues.
TIA!
Upvotes: 2
Views: 117
Reputation: 2165
Use strict mode: Place this at the top of your JS files
"use strict";
Also, there is a node module that can apply Strict Mode to all your modules.
Upvotes: 1