JSObject.makeError constructor
Creates a JavaScript Error object, as if by invoking the built-in Error constructor.
arguments
(JSValueRef[]) A JSValue array of arguments to pass to the Error Constructor. Pass NULL if argumentCount is 0.
exception
(JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
Implementation
JSObject.makeError(
this.context,
List<JSValue>? arguments, {
bool autoDispose = true,
}) {
final JSException exception = JSException.create(context);
_ref = JSObjectMakeError(
context.ref,
arguments?.length ?? 0,
arguments?.ref ?? nullptr,
exception.ref,
);
if (exception.shouldThrow) throw exception.error;
attach(calloc.nativeFree, _ref.cast(), autoDispose: autoDispose);
}