v8::ThrowException schedules an exception to be thrown when returning to JavaScript. At the point where you ask if it has been caught it has not been thrown yet.
On Thu, Jul 21, 2011 at 9:08 AM, Mads Sig Ager <a...@chromium.org> wrote:
> v8::ThrowException schedules an exception to be thrown when returning to > JavaScript. At the point where you ask if it has been caught it has not been > thrown yet.
i see. Thank you for that clarification.
The return value of ThrowException(): is it Undefined() or an Empty handle? i recall (perhaps incorrectly) reading both descriptions over the years.
On Thu, Jul 21, 2011 at 9:11 AM, Stephan Beal <sgb...@googlemail.com> wrote: > On Thu, Jul 21, 2011 at 9:08 AM, Mads Sig Ager <a...@chromium.org> wrote:
>> v8::ThrowException schedules an exception to be thrown when returning to >> JavaScript. At the point where you ask if it has been caught it has not been >> thrown yet.
> i see. Thank you for that clarification.
> The return value of ThrowException(): is it Undefined() or an Empty handle? > i recall (perhaps incorrectly) reading both descriptions over the years.
It is undefined.
It *can* return an empty handle, but only if calling into V8 before it is initialized or after it is dead (after an out of memory or similar).
On Thu, Jul 21, 2011 at 9:08 AM, Mads Sig Ager <a...@chromium.org> wrote:
> v8::ThrowException schedules an exception to be thrown when returning to > JavaScript. At the point where you ask if it has been caught it has not been > thrown yet.
A slight clarification: does "returning to JS" mean returning to a higher scope than the TryCatch, or calling back into v8 (perhaps in a deeper scope than the TryCatch, where the TC is still alive)?
On Thu, Jul 21, 2011 at 10:21 AM, Stephan Beal <sgb...@googlemail.com>wrote:
> On Thu, Jul 21, 2011 at 9:08 AM, Mads Sig Ager <a...@chromium.org> wrote:
>> v8::ThrowException schedules an exception to be thrown when returning to >> JavaScript. At the point where you ask if it has been caught it has not been >> thrown yet.
> A slight clarification: does "returning to JS" mean returning to a higher > scope than the TryCatch, or calling back into v8 (perhaps in a deeper scope > than the TryCatch, where the TC is still alive)?
It means actually returning to a JavaScript activation on the stack. Returning to other C++ code will not throw the exception.