This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree 2 files changed +3
-2
lines changed
test/end-to-end-tests/src
2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ export class ElementSession {
40
40
"requestfinished" , async ( req : puppeteer . HTTPRequest ) => {
41
41
const type = req . resourceType ( ) ;
42
42
const response = await req . response ( ) ;
43
- return `${ type } ${ response . status ( ) } ${ req . method ( ) } ${ req . url ( ) } \n` ;
43
+ return `${ type } ${ response ? .status ( ) ?? '<no response>' } ${ req . method ( ) } ${ req . url ( ) } \n` ;
44
44
} ) ;
45
45
this . log = new Logger ( this . username ) ;
46
46
}
Original file line number Diff line number Diff line change @@ -84,7 +84,8 @@ export async function serializeLog(msg: ConsoleMessage): Promise<string> {
84
84
// Note: we have to run the checks against the object in the page context, so call
85
85
// evaluate instead of just doing it ourselves.
86
86
const stringyArg : string = await arg . evaluate ( ( argInContext : any ) => {
87
- if ( argInContext . stack || ( argInContext instanceof Error ) ) {
87
+ // sometimes the argument will be `null` or similar - treat it safely.
88
+ if ( argInContext ?. stack || ( argInContext instanceof Error ) ) {
88
89
// probably an error - toString it and append any properties which might not be
89
90
// caught. For example, on HTTP errors the JSON stringification will capture the
90
91
// status code.
You can’t perform that action at this time.
0 commit comments