Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle server crash when req.failure() is null #379

Closed
wants to merge 1 commit into from

Conversation

Bujupah
Copy link
Contributor

@Bujupah Bujupah commented Nov 1, 2022

In some cases the browser request error is null and logging it directly as req.failure().errorText will cause the plugin to crash.

Fix is just to handle if req.failure() is undefined or not

@CLAassistant
Copy link

CLAassistant commented Nov 1, 2022

CLA assistant check
All committers have signed the CLA.

@Bujupah Bujupah changed the title Handle server crash when failure() is null in req Handle server crash when req.failure() is null Nov 1, 2022
@Bujupah
Copy link
Contributor Author

Bujupah commented Nov 1, 2022

Probably adding the parameter type to function will help avoiding these issues when compiling

  logRequest = (req: puppeteer.HTTPRequest) => {
    this.log.debug('Browser request', 'url', req.url(), 'method', req.method());
  };

  logRequestFailed = (req: puppeteer.HTTPRequest) => {
    this.log.error('Browser request failed', 'url', req.url(), 'method', req.method(), 'failure', req.failure()?.errorText);
  };

  logRequestFinished = (req: puppeteer.HTTPRequest) => {
    this.log.debug('Browser request finished', 'url', req.url(), 'method', req.method());
  };

@Bujupah
Copy link
Contributor Author

Bujupah commented Feb 27, 2023

Issue is fixed in this PR #403

@Bujupah Bujupah closed this Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants