You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

26 lines
609 B

/*===
my_func
fatal error: 123456 (reason)
===*/
void my_fatal_handler(duk_context *ctx, int code, const char *msg) {
printf("fatal error: %d (%s)\n", code, msg);
/* A fatal error handler must not return, so exit here */
exit(0);
}
int my_func(duk_context *ctx) {
printf("my_func\n");
duk_fatal(ctx, 123456, "reason");
printf("never here\n");
return 0;
}
void test(duk_context *ctx) {
duk_context *new_ctx;
new_ctx = duk_create_heap(NULL, NULL, NULL, NULL, my_fatal_handler);
duk_safe_call(new_ctx, my_func, 0, 1, DUK_INVALID_INDEX);
printf("duk_safe_call() returned, should not happen\n");
}