Skip to content

Commit

Permalink
Fix error when req.failure() is null (#403)
Browse files Browse the repository at this point in the history
* Fix error when req.failure() is null

* Apply suggestion
  • Loading branch information
spinillos authored Feb 10, 2023
1 parent 9178c13 commit 5686d65
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/browser/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,12 @@ export class Browser {
};

logRequestFailed = (req: any) => {
this.log.error('Browser request failed', 'url', req.url(), 'method', req.method(), 'failure', req.failure().errorText);
let failureError = ""
const failure = req?.failure();
if (failure) {
failureError = failure.errorText
}
this.log.error('Browser request failed', 'url', req.url(), 'method', req.method(), 'failure', failureError);
};

logRequestFinished = (req: any) => {
Expand Down

0 comments on commit 5686d65

Please sign in to comment.