forked from svaarala/duktape
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathduk_get_error_code.yaml
More file actions
29 lines (23 loc) · 1010 Bytes
/
duk_get_error_code.yaml
File metadata and controls
29 lines (23 loc) · 1010 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
name: duk_get_error_code
proto: |
duk_errcode_t duk_get_error_code(duk_context *ctx, duk_idx_t idx);
stack: |
[ ... val! ... ]
summary: |
<p>Map the value at <code>idx</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 inherits from <code>Error</code> but doesn't inherit from any of
the standard subclasses (EvalError, RangeError, ReferenceError, SyntaxError,
TypeError, URIError) <code>DUK_ERR_ERROR</code> is returned.
If the value is not an object, does not inherit from <code>Error</code>, or
<code>idx</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