name: duk_push_error_object proto: | duk_idx_t duk_push_error_object(duk_context *ctx, duk_errcode_t err_code, const char *fmt, ...); stack: | [ ... ] -> [ ... err! ] summary: |
Create a new error object and push it to the value stack (the error is not thrown). Returns non-negative index (relative to stack bottom) of the pushed error object.
The message
property of the error object will be set to a sprintf
-formatted
string using fmt
and the remaining arguments. The internal prototype for the created
error object is chosen based on err_code
. For instance, DUK_ERR_RANGE_ERROR
causes the built-in RangeError
prototype to be used. The valid range for user error
codes is [1,16777215].