Skip to content

Commit 5686d65

Browse files
authored
Fix error when req.failure() is null (#403)
* Fix error when req.failure() is null * Apply suggestion
1 parent 9178c13 commit 5686d65

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/browser/browser.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,12 @@ export class Browser {
537537
};
538538

539539
logRequestFailed = (req: any) => {
540-
this.log.error('Browser request failed', 'url', req.url(), 'method', req.method(), 'failure', req.failure().errorText);
540+
let failureError = ""
541+
const failure = req?.failure();
542+
if (failure) {
543+
failureError = failure.errorText
544+
}
545+
this.log.error('Browser request failed', 'url', req.url(), 'method', req.method(), 'failure', failureError);
541546
};
542547

543548
logRequestFinished = (req: any) => {

0 commit comments

Comments
 (0)