File: class-weberror.md | Updated: 11/18/2025
On this page
WebError class represents an unhandled exception thrown in the page. It is dispatched via the BrowserContext.onWebError(handler) event.
// Log all uncaught errors to the terminalcontext.onWebError(webError -> { System.out.println("Uncaught exception: " + webError.error());});// Navigate to a page with an exception.page.navigate("data:text/html,<script>throw new Error('Test')</script>");
Methods
Added in: v1.38 webError.error
Unhandled error that was thrown.
Usage
WebError.error();
Returns
Added in: v1.38 webError.page
The page that produced this unhandled exception, if any.
Usage
WebError.page();
Returns