What happens when you throw a C++ exception from a FunctionTemplate callback function?

157 views
Skip to first unread message

Zac Hansen

unread,
Feb 4, 2016, 2:10:32 AM2/4/16
to v8-users
Here is a full, stand-alone reproduction case and stack trace for my problem:  https://gist.github.com/xaxxon/d45ba2bd11675735b4fa

When I throw a normal c++ exception from a FunctionTemplate callback function, my process immediately goes into pthread_kill.   

It feels a lot like something down the stack is marked noexcept, but I don't know what - or if it is even frames 13-16 in my stack trace in the above link which I'm guessing are v8-generated calls.  Nothing in the include/ or src/ directories seems to be marked noexcept, but there are a very large number of things in third_party with "noexcept".

In the process of working through this I learned about Isolate::ThrowException and that seems to work for what I need, but I'm wondering if this is intended behavior (maybe even documented somewhere?) or if I've hit some edge case.

Thank you.

--Zac

Jakob Kummerow

unread,
Feb 4, 2016, 3:45:20 AM2/4/16
to v8-users
All of V8 is compiled with -fno-exceptions, so it doesn't support C++ exceptions. You could try building without that flag, but then you'd be entirely on your own you find that something doesn't work (and I'm pretty sure that something wouldn't work -- V8 code is not written to be exception safe).

The exception system that V8 implements for JavaScript code (via Isolate::ThrowException, v8::TryCatch, etc) is completely unrelated to C++ exceptions.

--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Zac Hansen

unread,
Feb 4, 2016, 3:50:47 AM2/4/16
to v8-users
Good to know, thank you.
Reply all
Reply to author
Forward
0 new messages