Node.js is compiled with C++ exceptions disabled, and so addons also get
compiled with C++ exceptions disabled. You can manually enable the
exceptions though. See:
https://github.com/TooTallNate/node-gyp/issues/17#issuecomment-3917672


On Tue, Feb 4, 2014 at 4:06 AM, Anwar Ludin <[email protected]> wrote:

> Hi,
>
> I've already asked this question on stackoverflow and reproducing it here.
> I am currently developing a node add-on for the armadillo linear algebra
> library. Armadillo throws exceptions when the matrix is ill-formed and I am
> trying to catch the exception in my node add-on:
>
> if(args[0].isString()){
>     try{
>         std::string s(*v8::String::AsciiValue(args[0]->ToString()));
>         MatrixWrap* matrix = new MatrixWrap(s); // if s is not correctly 
> formatting throws exception
>         matrix->Wrap(args.This());
>     }catch(exception& e){
>         cout << "caught exception" << endl;  // this code is never called.
>     }}
>
> It seems that the exception is never cought in my node add-on (the exception 
> is propagated and the node process
>
> is terminated. Any ideas would be welcome.
>
>  --
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to