"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[83984],{3905:function(e,r,t){t.d(r,{Zo:function(){return c},kt:function(){return m}});var p=t(67294);function n(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);r&&(p=p.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,p)}return t}function a(e){for(var r=1;r=0||(n[t]=e[t]);return n}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(p=0;p=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}var u=p.createContext({}),s=function(e){var r=p.useContext(u),t=r;return e&&(t="function"==typeof e?e(r):a(a({},r),e)),t},c=function(e){var r=s(e.components);return p.createElement(u.Provider,{value:r},e.children)},l={inlineCode:"code",wrapper:function(e){var r=e.children;return p.createElement(p.Fragment,{},r)}},f=p.forwardRef((function(e,r){var t=e.components,n=e.mdxType,o=e.originalType,u=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),f=s(t),m=n,d=f["".concat(u,".").concat(m)]||f[m]||l[m]||o;return t?p.createElement(d,a(a({ref:r},c),{},{components:t})):p.createElement(d,a({ref:r},c))}));function m(e,r){var t=arguments,n=r&&r.mdxType;if("string"==typeof e||n){var o=t.length,a=new Array(o);a[0]=f;var i={};for(var u in r)hasOwnProperty.call(r,u)&&(i[u]=r[u]);i.originalType=e,i.mdxType="string"==typeof e?e:n,a[1]=i;for(var s=2;s"," ",(0,o.kt)("a",{parentName:"p",href:"/puppeteer/docs/puppeteer"},"puppeteer")," ",">"," ",(0,o.kt)("a",{parentName:"p",href:"/puppeteer/docs/puppeteer.puppeteer"},"Puppeteer")," ",">"," ",(0,o.kt)("a",{parentName:"p",href:"/puppeteer/docs/puppeteer.puppeteer.errors"},"errors")),(0,o.kt)("h2",{id:"puppeteererrors-property"},"Puppeteer.errors property"),(0,o.kt)("b",null,"Signature:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"get errors(): PuppeteerErrors;\n")),(0,o.kt)("h2",{id:"remarks"},"Remarks"),(0,o.kt)("p",null,"Puppeteer methods might throw errors if they are unable to fulfill a request. For example, ",(0,o.kt)("inlineCode",{parentName:"p"},"page.waitForSelector(selector[, options])")," might fail if the selector doesn't match any nodes during the given timeframe."),(0,o.kt)("p",null,"For certain types of errors Puppeteer uses specific error classes. These classes are available via ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer.errors"),"."),(0,o.kt)("h2",{id:"example"},"Example"),(0,o.kt)("p",null,"An example of handling a timeout error:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"try {\n await page.waitForSelector('.foo');\n} catch (e) {\n if (e instanceof puppeteer.errors.TimeoutError) {\n // Do something if this is a timeout.\n }\n}\n\n")))}f.isMDXComponent=!0}}]);