4

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!

Pavel Minaev
  • 99,783
  • 25
  • 219
  • 289
Gabriel
  • 327
  • 4
  • 13

1 Answers1

3

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.

http://nodejstools.codeplex.com/discussions/538432

Fortin
  • 152
  • 2
  • 14
  • 1
    I guess I will have to wait until next release then, can't believe I missed this on their discussions. Thanks! – Gabriel Mar 27 '14 at 14:15
  • 2
    We release dev builds, usually one every week or so - if you want to try out the most recent fixes and additions, you should check them out! – Pavel Minaev May 15 '14 at 02:54
  • @PavelMinaev honestly I didn't even think about it before. I will try them for sure ! There are a few things I find unstable in the beta version that hopefully are already fixed in the dev builds – Gabriel May 15 '14 at 14:33