mirror of https://github.com/svaarala/duktape.git
Sami Vaarala
11 years ago
2 changed files with 34 additions and 0 deletions
@ -0,0 +1,17 @@ |
|||
/*===
|
|||
rc=1 -> throw me |
|||
===*/ |
|||
|
|||
int test_1(duk_context *ctx) { |
|||
duk_push_string(ctx, "throw me"); |
|||
duk_throw(ctx); |
|||
return 0; |
|||
} |
|||
|
|||
void test(duk_context *ctx) { |
|||
int rc; |
|||
|
|||
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX); |
|||
printf("rc=%d -> %s\n", rc, duk_get_string(ctx, -1)); |
|||
} |
|||
|
@ -0,0 +1,17 @@ |
|||
=proto |
|||
void duk_throw(duk_context *ctx); |
|||
|
|||
=stack |
|||
[ ... val! ] |
|||
|
|||
=summary |
|||
<p>Throw the value on top of the stack. This call never returns.</p> |
|||
|
|||
=example |
|||
/* Throw a string value; equivalent to the Ecmascript code: |
|||
* |
|||
* throw "this string is thrown"; |
|||
*/ |
|||
|
|||
duk_push_string(ctx, "this string is thrown"); |
|||
duk_throw(ctx); |
Loading…
Reference in new issue