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

[Bug] PuppeteerExtraPluginRecaptcha error has no information and cannot be evaluated #740

Open
markcellus opened this issue Oct 26, 2022 · 1 comment · May be fixed by #741
Open

[Bug] PuppeteerExtraPluginRecaptcha error has no information and cannot be evaluated #740

markcellus opened this issue Oct 26, 2022 · 1 comment · May be fixed by #741
Labels
issue: bug report A bug has been reported needs triage

Comments

@markcellus
Copy link

markcellus commented Oct 26, 2022

Describe the bug

Currently, when using the puppeteer-extra-plugin-recaptcha package with throwOnError set to true and a PuppeteerExtraPluginRecaptcha error is thrown here, the argument passed to Error is an object. So the information on the error gets lost, leaving no way for consumer code to know about what caused the error.

It just outputs the following as a console warning:

PuppeteerExtraPluginRecaptcha: An error occured during "getRecaptchaSolutions": {
_vendor: 'recaptcha',
provider: '2captcha',
id: '[redacted]',
requestAt: 2021-05-09T01:35:25.450Z,
error: 'Error: 2captcha error: [redacted]'
}

...and the thrown error is an empty object, so it can't be evaluated:

try {
        let { captchas } = await page.findRecaptchas();
        if (!captchas.length) {
            return;
        }
        await page.solveRecaptchas();
    } catch (e) {
        console.log(e) // <== cannot evaluate this error because it has no information
    }
@markcellus markcellus added issue: bug report A bug has been reported needs triage labels Oct 26, 2022
@markcellus markcellus linked a pull request Oct 26, 2022 that will close this issue
@markcellus
Copy link
Author

I've opened #741 to attempt to address. Open to any feedback! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug report A bug has been reported needs triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant