/*! For license information please see e4d261d9.8f455d72.js.LICENSE.txt */ "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[90657],{94021:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>s,metadata:()=>i,toc:()=>p});var n=t(85893),o=t(11151);const s={sidebar_label:"errors"},a="errors variable",i={id:"api/puppeteer.errors",title:"errors variable",description:"Warning: This API is now obsolete.",source:"@site/../docs/api/puppeteer.errors.md",sourceDirName:"api",slug:"/api/puppeteer.errors",permalink:"/next/api/puppeteer.errors",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{sidebar_label:"errors"},sidebar:"api",previous:{title:"ErrorCode",permalink:"/next/api/puppeteer.errorcode"},next:{title:"EvaluateFunc",permalink:"/next/api/puppeteer.evaluatefunc"}},l={},p=[{value:"Signature:",id:"signature",level:4},{value:"Example",id:"example",level:2}];function c(e){const r={blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h4:"h4",p:"p",pre:"pre",...(0,o.a)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r.h1,{id:"errors-variable",children:"errors variable"}),"\n",(0,n.jsxs)(r.blockquote,{children:["\n",(0,n.jsx)(r.p,{children:"Warning: This API is now obsolete."}),"\n",(0,n.jsx)(r.p,{children:"Import error classes directly."}),"\n",(0,n.jsxs)(r.p,{children:["Puppeteer methods might throw errors if they are unable to fulfill a request. For example, ",(0,n.jsx)(r.code,{children:"page.waitForSelector(selector[, options])"})," might fail if the selector doesn't match any nodes during the given timeframe."]}),"\n",(0,n.jsxs)(r.p,{children:["For certain types of errors Puppeteer uses specific error classes. These classes are available via ",(0,n.jsx)(r.code,{children:"puppeteer.errors"}),"."]}),"\n"]}),"\n",(0,n.jsx)(r.h4,{id:"signature",children:"Signature:"}),"\n",(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{className:"language-typescript",children:"errors: PuppeteerErrors;\n"})}),"\n",(0,n.jsx)(r.h2,{id:"example",children:"Example"}),"\n",(0,n.jsx)(r.p,{children:"An example of handling a timeout error:"}),"\n",(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{className:"language-ts",children:"try {\n await page.waitForSelector('.foo');\n} catch (e) {\n if (e instanceof TimeoutError) {\n // Do something if this is a timeout.\n }\n}\n"})})]})}function u(e={}){const{wrapper:r}={...(0,o.a)(),...e.components};return r?(0,n.jsx)(r,{...e,children:(0,n.jsx)(c,{...e})}):c(e)}},75251:(e,r,t)=>{var n=t(67294),o=Symbol.for("react.element"),s=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function p(e,r,t){var n,s={},p=null,c=null;for(n in void 0!==t&&(p=""+t),void 0!==r.key&&(p=""+r.key),void 0!==r.ref&&(c=r.ref),r)a.call(r,n)&&!l.hasOwnProperty(n)&&(s[n]=r[n]);if(e&&e.defaultProps)for(n in r=e.defaultProps)void 0===s[n]&&(s[n]=r[n]);return{$$typeof:o,type:e,key:p,ref:c,props:s,_owner:i.current}}r.Fragment=s,r.jsx=p,r.jsxs=p},85893:(e,r,t)=>{e.exports=t(75251)},11151:(e,r,t)=>{t.d(r,{Z:()=>i,a:()=>a});var n=t(67294);const o={},s=n.createContext(o);function a(e){const r=n.useContext(s);return n.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function i(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:a(e.components),n.createElement(s.Provider,{value:r},e.children)}}}]);