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.
 
 
 
 
 
 

25 lines
730 B

=proto
duk_errcode_t duk_get_error_code(duk_context *ctx, duk_idx_t index);
=stack
[ ... val! ... ]
=summary
<p>Map the value at <code>index</code> to the error codes <code>DUK_ERR_xxx</code>
based on which <code>Error</code> subclass the value inherits from. For example,
if the value at the stack top is an user-defined error which inherits from
<code>ReferenceError</code>, the return value will be <code>DUK_ERR_REFERENCE_ERROR</code>.
If the value is not an object, does not inherit from <code>Error</code>, or <code>index</code>
is invalid, returns 0 (= <code>DUK_ERR_NONE</code>).</p>
=example
if (duk_get_error_code(ctx, -3) == DUK_ERR_URI_ERROR) {
printf("Invalid URI\n");
}
=tags
stack
error
=introduced
1.1.0