(error: BrowserTimeoutParseError)
| 72 | } |
| 73 | |
| 74 | function browserTimeoutErrorMessage(error: BrowserTimeoutParseError): { |
| 75 | title: string; |
| 76 | message: string; |
| 77 | hint?: string; |
| 78 | } { |
| 79 | const title = "Invalid browser-timeout"; |
| 80 | switch (error.kind) { |
| 81 | case "not-a-number": |
| 82 | return { |
| 83 | title, |
| 84 | message: `Got "${error.raw}", which is not a number. Pass a positive number of seconds (e.g. 180).`, |
| 85 | }; |
| 86 | case "not-positive": |
| 87 | return { |
| 88 | title, |
| 89 | message: `Got "${error.raw}" seconds, which is not positive. Pass a positive number of seconds (e.g. 180).`, |
| 90 | }; |
| 91 | case "too-small": |
| 92 | return { |
| 93 | title, |
| 94 | message: `Got "${error.raw}" seconds, which rounds to 0 ms. Puppeteer treats 0 as 'no timeout' — pass a value that rounds to at least 1 ms.`, |
| 95 | }; |
| 96 | case "too-large": |
| 97 | return { |
| 98 | title, |
| 99 | message: `Got "${error.raw}" seconds, which exceeds the ${MAX_PAGE_NAVIGATION_TIMEOUT_SECONDS}s (24h) cap. Node's setTimeout overflows for larger values.`, |
| 100 | }; |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * Side-effecting wrapper around `parseBrowserTimeoutMsArg`. Exits the |
no outgoing calls
no test coverage detected