Skip to content

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

@markcellus

Description

@markcellus

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
    }

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions