Interface WebError

WebError class represents an unhandled exception thrown in the page. It is dispatched via the browserContext.on('weberror') event.

// Log all uncaught errors to the terminal
context.on('weberror', webError => {
console.log(`Uncaught exception: "${webError.error()}"`);
});

// Navigate to a page with an exception.
await page.goto('data:text/html,<script>throw new Error("Test")</script>');
interface WebError {
    error(): Error;
    location(): {
        column: number;
        line: number;
        url: string;
    };
    page(): Page;
}

Methods

  • Unhandled error that was thrown.

    Returns Error

  • Returns {
        column: number;
        line: number;
        url: string;
    }

    • column: number

      0-based column number in the resource.

    • line: number

      0-based line number in the resource.

    • url: string

      URL of the resource.

  • The page that produced this unhandled exception, if any.

    Returns Page