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
561 B

name: duk_is_error
proto: |
duk_bool_t duk_is_error(duk_context *ctx, duk_idx_t index);
stack: |
[ ... val! ... ]
summary: |
<p>Returns 1 if value at <code>index</code> inherits from <code>Error</code>,
otherwise returns 0. If <code>index</code> is invalid, also returns 0.</p>
example: |
if (duk_is_error(ctx, -3)) {
/* Inherits from Error, attempt to print stack trace */
duk_get_prop_string(ctx, -3, "stack");
printf("%s\n", duk_safe_to_string(ctx, -1));
duk_pop(ctx);
}
tags:
- stack
- error
introduced: 1.1.0