Skip to main content

build_native_error

Function build_native_error 

Source
pub fn build_native_error<'js>(
    ctx: &Ctx<'js>,
    details: &ErrorDetails,
) -> Result<Value<'js>>
Expand description

Shared helper: construct a native JS Error from an ErrorDetails snapshot. Reused by WebErrorJs::error (context-scoped) AND by PageJs::waitForEvent('pageerror') (page-scoped, Playwright-parity Promise<Error>).

Constructs the Error natively via the global Error constructor (rquickjs::function::Constructor::construct, the same call-as-new path page.route uses for new URL(...)), then sets name and a non-empty stack on the instance. No ctx.eval of a JS factory.