puppeteer/assets/js/d354867c.c67c3801.js
release-please[bot] d321f9557a deploy: 8c0ac61260
2023-12-06 08:09:55 +00:00

2 lines
3.4 KiB
JavaScript

/*! For license information please see d354867c.c67c3801.js.LICENSE.txt */
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[67390],{31356:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>i,default:()=>u,frontMatter:()=>s,metadata:()=>a,toc:()=>p});var n=t(85893),o=t(11151);const s={sidebar_label:"errors"},i="errors variable",a={id:"api/puppeteer.errors",title:"errors variable",description:"Warning: This API is now obsolete.",source:"@site/versioned_docs/version-21.6.0/api/puppeteer.errors.md",sourceDirName:"api",slug:"/api/puppeteer.errors",permalink:"/api/puppeteer.errors",draft:!1,unlisted:!1,tags:[],version:"21.6.0",frontMatter:{sidebar_label:"errors"},sidebar:"api",previous:{title:"ErrorCode",permalink:"/api/puppeteer.errorcode"},next:{title:"EvaluateFunc",permalink:"/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"),i=Object.prototype.hasOwnProperty,a=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)i.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:a.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:()=>a,a:()=>i});var n=t(67294);const o={},s=n.createContext(o);function i(e){const r=n.useContext(s);return n.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function a(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),n.createElement(s.Provider,{value:r},e.children)}}}]);