"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[54840],{3905:function(e,t,r){r.d(t,{Zo:function(){return s},kt:function(){return m}});var n=r(67294);function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(p[r]=e[r]);return p}(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(p[r]=e[r])}return p}var i=n.createContext({}),l=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},s=function(e){var t=l(e.components);return n.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,p=e.mdxType,u=e.originalType,i=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),f=l(r),m=p,d=f["".concat(i,".").concat(m)]||f[m]||c[m]||u;return r?n.createElement(d,a(a({ref:t},s),{},{components:r})):n.createElement(d,a({ref:t},s))}));function m(e,t){var r=arguments,p=t&&t.mdxType;if("string"==typeof e||p){var u=r.length,a=new Array(u);a[0]=f;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o.mdxType="string"==typeof e?e:p,a[1]=o;for(var l=2;l"," ",(0,u.kt)("a",{parentName:"p",href:"/puppeteer/docs/10.0.0/puppeteer"},"puppeteer")," ",">"," ",(0,u.kt)("a",{parentName:"p",href:"/puppeteer/docs/10.0.0/puppeteer.httprequest"},"HTTPRequest")," ",">"," ",(0,u.kt)("a",{parentName:"p",href:"/puppeteer/docs/10.0.0/puppeteer.httprequest.failure"},"failure")),(0,u.kt)("h2",{id:"httprequestfailure-method"},"HTTPRequest.failure() method"),(0,u.kt)("p",null,"Access information about the request's failure."),(0,u.kt)("b",null,"Signature:"),(0,u.kt)("pre",null,(0,u.kt)("code",{parentName:"pre",className:"language-typescript"},"failure(): {\n errorText: string;\n } | null;\n")),(0,u.kt)("b",null,"Returns:"),(0,u.kt)("p",null,"{ errorText: string; } ","|"," null"),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"null")," unless the request failed. If the request fails this can return an object with ",(0,u.kt)("inlineCode",{parentName:"p"},"errorText")," containing a human-readable error message, e.g. ",(0,u.kt)("inlineCode",{parentName:"p"},"net::ERR_FAILED"),". It is not guaranteeded that there will be failure text if the request fails."),(0,u.kt)("h2",{id:"remarks"},"Remarks"),(0,u.kt)("h2",{id:"example"},"Example"),(0,u.kt)("p",null,"Example of logging all failed requests:"),(0,u.kt)("pre",null,(0,u.kt)("code",{parentName:"pre",className:"language-js"},"page.on('requestfailed', request => {\n console.log(request.url() + ' ' + request.failure().errorText);\n});\n\n")))}f.isMDXComponent=!0}}]);