2 * Do a longjmp call, calling the fatal error handler if no
6 #include "duk_internal.h"
8 DUK_INTERNAL
void duk_err_longjmp(duk_hthread
*thr
) {
9 DUK_ASSERT(thr
!= NULL
);
11 DUK_DD(DUK_DDPRINT("longjmp error: type=%d iserror=%d value1=%!T value2=%!T",
12 (int) thr
->heap
->lj
.type
, (int) thr
->heap
->lj
.iserror
,
13 &thr
->heap
->lj
.value1
, &thr
->heap
->lj
.value2
));
15 #if !defined(DUK_USE_CPP_EXCEPTIONS)
16 /* If we don't have a jmpbuf_ptr, there is little we can do
17 * except panic. The caller's expectation is that we never
20 * With C++ exceptions we now just propagate an uncaught error
21 * instead of invoking the fatal error handler. Because there's
22 * a dummy jmpbuf for C++ exceptions now, this could be changed.
24 if (!thr
->heap
->lj
.jmpbuf_ptr
) {
26 DUK_D(DUK_DPRINT("uncaught error: type=%d iserror=%d value1=%!T value2=%!T",
27 (int) thr
->heap
->lj
.type
, (int) thr
->heap
->lj
.iserror
,
28 &thr
->heap
->lj
.value1
, &thr
->heap
->lj
.value2
));
30 duk_fatal((duk_context
*) thr
, DUK_ERR_UNCAUGHT_ERROR
, "uncaught error");
33 #endif /* DUK_USE_CPP_EXCEPTIONS */
35 #if defined(DUK_USE_CPP_EXCEPTIONS)
37 duk_internal_exception exc
; /* dummy */
40 #else /* DUK_USE_CPP_EXCEPTIONS */
41 DUK_LONGJMP(thr
->heap
->lj
.jmpbuf_ptr
->jb
);
42 #endif /* DUK_USE_CPP_EXCEPTIONS */