|
|
@ -1,7 +1,7 @@ |
|
|
|
name: duk_error |
|
|
|
|
|
|
|
proto: | |
|
|
|
void duk_error(duk_context *ctx, duk_errcode_t err_code, const char *fmt, ...); |
|
|
|
duk_ret_t duk_error(duk_context *ctx, duk_errcode_t err_code, const char *fmt, ...); |
|
|
|
|
|
|
|
stack: | |
|
|
|
[ ... ] -> [ ... err! ] |
|
|
@ -20,6 +20,14 @@ summary: | |
|
|
|
<code><a href="#duk_push_error_object">duk_push_error_object()</a></code>. |
|
|
|
</p> |
|
|
|
|
|
|
|
<p>Even though the function never returns, the prototype describes a return |
|
|
|
value which allows code such as:</p> |
|
|
|
<pre class="c-code"> |
|
|
|
if (argvalue < 0) { |
|
|
|
return duk_error(ctx, DUK_ERR_TYPE_ERROR, "invalid argument value: %d", (int) argvalue); |
|
|
|
} |
|
|
|
</pre> |
|
|
|
|
|
|
|
example: | |
|
|
|
duk_error(ctx, DUK_ERR_RANGE_ERROR, "argument out of range: %d", (int) argval); |
|
|
|
|
|
|
|