1"use strict";(self.webpackChunkplaywright_dev=self.webpackChunkplaywright_dev||[]).push([["2256"],{98440(e,r,n){n.r(r),n.d(r,{metadata:()=>s,default:()=>h,frontMatter:()=>i,contentTitle:()=>o,toc:()=>c,assets:()=>a});var s=JSON.parse('{"id":"api/class-weberror","title":"WebError","description":"WebError] class represents an unhandled exception thrown in the page. It is dispatched via the [browserContext.on(\'weberror\') event.","source":"@site/docs/api/class-weberror.mdx","sourceDirName":"api","slug":"/api/class-weberror","permalink":"/docs/next/api/class-weberror","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{"id":"class-weberror","title":"WebError"},"sidebar":"api","previous":{"title":"Video","permalink":"/docs/next/api/class-video"},"next":{"title":"WebSocket","permalink":"/docs/next/api/class-websocket"}}'),t=n(74848),l=n(28453);n(13554),n(41647),n(83137);let i={id:"class-weberror",title:"WebError"},o,a={},c=[{value:"Methods",id:"methods",level:2},{value:"error",id:"web-error-error",level:3},{value:"location",id:"web-error-location",level:3},{value:"page",id:"web-error-page",level:3}];function d(e){let r={a:"a",code:"code",h2:"h2",h3:"h3",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,l.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(r.p,{children:[(0,t.jsx)(r.a,{href:"/docs/next/api/class-weberror",title:"WebError",children:"WebError"})," class represents an unhandled exception thrown in the page. It is dispatched via the ",(0,t.jsx)(r.a,{href:"/docs/next/api/class-browsercontext#browser-context-event-web-error",children:"browserContext.on('weberror')"})," event."]}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-js",children:"// Log all uncaught errors to the terminal\ncontext.on('weberror', webError => {\n console.log(`Uncaught exception: \"${webError.error()}\"`);\n});\n\n// Navigate to a page with an exception.\nawait page.goto('data:text/html,<script>throw new Error(\"Test\")<\/script>');\n"})}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h2,{id:"methods",children:"Methods"}),"\n",(0,t.jsx)(r.h3,{id:"web-error-error",children:"error"}),"\n",(0,t.jsx)("font",{size:"2",style:{position:"relative",top:"-20px"},children:"Added in: v1.38"}),"\n",(0,t.jsx)("x-search",{children:"webError.error"}),"\n",(0,t.jsx)(r.p,{children:"Unhandled error that was thrown."}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Usage"})}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-js",children:"webError.error();\n"})}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.ul,{children:["\n",(0,t.jsxs)(r.li,{children:[(0,t.jsx)(r.a,{href:"https://nodejs.org/api/errors.html#errors_class_error",title:"Error",children:"Error"}),(0,t.jsx)("a",{"aria-hidden":"true",tabIndex:"-1",class:"list-anchor-link",id:"web-error-error-return"}),(0,t.jsx)("a",{href:"#web-error-error-return",class:"list-anchor",children:"#"})]}),"\n"]}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h3,{id:"web-error-location",children:"location"}),"\n",(0,t.jsx)("font",{size:"2",style:{position:"relative",top:"-20px"},children:"Added in: v1.60"}),"\n",(0,t.jsx)("x-search",{children:"webError.location"}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Usage"})}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-js",children:"webError.location();\n"})}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.ul,{children:["\n",(0,t.jsxs)(r.li,{children:[(0,t.jsx)(r.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object",title:"Object",children:"Object"}),(0,t.jsx)("a",{"aria-hidden":"true",tabIndex:"-1",class:"list-anchor-link",id:"web-error-location-return"}),(0,t.jsx)("a",{href:"#web-error-location-return",class:"list-anchor",children:"#"}),"\n",(0,t.jsxs)(r.ul,{children:["\n",(0,t.jsxs)(r.li,{children:["\n",(0,t.jsxs)(r.p,{children:[(0,t.jsx)(r.code,{children:"url"})," ",(0,t.jsx)(r.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type",title:"string",children:"string"})]}),"\n",(0,t.jsx)(r.p,{children:"URL of the resource."}),"\n"]}),"\n",(0,t.jsxs)(r.li,{children:["\n",(0,t.jsxs)(r.p,{children:[(0,t.jsx)(r.code,{children:"line"})," ",(0,t.jsx)(r.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type",title:"Number",children:"number"})]}),"\n",(0,t.jsx)(r.p,{children:"0-based line number in the resource."}),"\n"]}),"\n",(0,t.jsxs)(r.li,{children:["\n",(0,t.jsxs)(r.p,{children:[(0,t.jsx)(r.code,{children:"column"})," ",(0,t.jsx)(r.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type",title:"Number",children:"number"})]}),"\n",(0,t.jsx)(r.p,{children:"0-based column number in the resource."}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,t.jsx)(r.hr,{}),"\n",(0,t.jsx)(r.h3,{id:"web-error-page",children:"page"}),"\n",(0,t.jsx)("font",{size:"2",style:{position:"relative",top:"-20px"},children:"Added in: v1.38"}),"\n",(0,t.jsx)("x-search",{children:"webError.page"}),"\n",(0,t.jsx)(r.p,{children:"The page that produced this unhandled exception, if any."}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Usage"})}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-js",children:"webError.page();\n"})}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.strong,{children:"Returns"})}),"\n",(0,t.jsxs)(r.ul,{children:["\n",(0,t.jsxs)(r.li,{children:[(0,t.jsx)(r.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null",title:"null",children:"null"})," | ",(0,t.jsx)(r.a,{href:"/docs/next/api/class-page",title:"Page",children:"Page"}),(0,t.jsx)("a",{"aria-hidden":"true",tabIndex:"-1",class:"list-anchor-link",id:"web-error-page-return"}),(0,t.jsx)("a",{href:"#web-error-page-return",class:"list-anchor",children:"#"})]}),"\n"]})]})}function h(e={}){let{wrapper:r}={...(0,l.R)(),...e.components};return r?(0,t.jsx)(r,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.