Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
duktape-1.5.2/src-separate/duk_error_longjmp.c
Go to the documentation of this file.
1/*
2 * Do a longjmp call, calling the fatal error handler if no
3 * catchpoint exists.
4 */
5
6#include "duk_internal.h"
7
9 DUK_ASSERT(thr != NULL);
10
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));
14
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
18 * return.
19 *
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.
23 */
24 if (!thr->heap->lj.jmpbuf_ptr) {
25
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));
29
30 duk_fatal((duk_context *) thr, DUK_ERR_UNCAUGHT_ERROR, "uncaught error");
32 }
33#endif /* DUK_USE_CPP_EXCEPTIONS */
34
35#if defined(DUK_USE_CPP_EXCEPTIONS)
36 {
37 duk_internal_exception exc; /* dummy */
38 throw exc;
39 }
40#else /* DUK_USE_CPP_EXCEPTIONS */
42#endif /* DUK_USE_CPP_EXCEPTIONS */
43
45}
DUK_EXTERNAL void duk_fatal(duk_context *ctx, duk_errcode_t err_code, const char *err_msg)
#define DUK_ERR_UNCAUGHT_ERROR
DUK_INTERNAL void duk_err_longjmp(duk_hthread *thr)
#define NULL
Definition gmacros.h:924