NTVS currently reports all exceptions whenever they are thrown - we can't determine whether they're caught somewhere up the stack. Those missing module exceptions are virtually always caught. For the time being, you can add this exception type to Debug -> Exceptions, and disable breaking on it, if you don't want to press F5 every time to move on. In the upcoming beta release, this setting will be there by default.
Node.js tools for Visual Studio always stops on exceptions
-
22-06-2023 - |
Domanda
So I have been using Node.js tools for Visual Studio (https://nodejstools.codeplex.com) for a while.
I have this recurring problem where it will always start debugging when there is an exception. This may sound like a good thing but not when the exception is supposed to be catched !
Take this for example (this is from bson module)
try {
// Load the precompiled win32 binary
if(process.platform == "win32" && process.arch == "x64") {
bson = require('./win32/x64/bson');
} else if(process.platform == "win32" && process.arch == "ia32") {
bson = require('./win32/ia32/bson');
} else {
bson = require('../build/Release/bson');
}
} catch(err) {
console.error("Failed to load c++ bson extension, using pure JS version");
bson = require('../lib/bson/bson');
}
Here it is going to go into debug before getting catched to use the pure JS version, this is an expected behavior but I would like VS to avoid starting debug when it's getting catched afterward... (is this clear?)
My temporary solution is to go to Debug/Exceptions/Node.js Exceptions and uncheck "Thrown" for everything under Error... but then when I get real errors I need thrown, debugger doesn't pick them.
Maybe it's just a limitation with the tools since it's pretty new, but if someone else found a solution it would be really helpful!
Soluzione