File tree Expand file tree Collapse file tree 2 files changed +4
-16
lines changed
browser-crawler/src/internals Expand file tree Collapse file tree 2 files changed +4
-16
lines changed Original file line number Diff line number Diff line change @@ -578,7 +578,7 @@ export abstract class BrowserCrawler<
578578 } ,
579579 this . navigationTimeoutMillis ,
580580 // This message will never be seen, but is required by addTimeoutToPromise
581- `Navigation timed out after ${ this . navigationTimeoutMillis / 1000 } seconds. ` ,
581+ `Navigation timed out after ${ this . navigationTimeoutMillis } ms ` ,
582582 ) ;
583583 } catch ( error ) {
584584 // Handle navigation timeout - mark session bad and close page
Original file line number Diff line number Diff line change @@ -8,19 +8,7 @@ import type { Session } from '../session_pool/session.js';
88 */
99export function handleRequestTimeout ( { session, errorMessage } : { session ?: Session ; errorMessage : string } ) {
1010 session ?. markBad ( ) ;
11-
12- // Look for both "ms" and "seconds" patterns
13- const timeoutMillis = errorMessage . match ( / ( \d + ) \s ? m s / ) ?. [ 1 ] ;
14- const timeoutSecs = errorMessage . match ( / ( \d + (?: \. \d + ) ? ) \s ? s e c o n d s ? / ) ?. [ 1 ] ;
15-
16- let finalTimeoutSecs : number ;
17- if ( timeoutMillis ) {
18- finalTimeoutSecs = Number ( timeoutMillis ) / 1000 ;
19- } else if ( timeoutSecs ) {
20- finalTimeoutSecs = Number ( timeoutSecs ) ;
21- } else {
22- finalTimeoutSecs = 0 ; // fallback
23- }
24-
25- throw new TimeoutError ( `Navigation timed out after ${ finalTimeoutSecs } seconds.` ) ;
11+ const timeoutMillis = errorMessage . match ( / ( \d + ) \s ? m s / ) ?. [ 1 ] ; // first capturing group
12+ const timeoutSecs = Number ( timeoutMillis ) / 1000 ;
13+ throw new TimeoutError ( `Navigation timed out after ${ timeoutSecs } seconds.` ) ;
2614}
You can’t perform that action at this time.
0 commit comments