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

Expose PuppeteerExtraPluginRecaptcha error #741

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

markcellus
Copy link

Resolves #740 by updating the PuppeteerExtraPluginRecaptcha thrown error and exposes all of its properties to be evaluated by consumer code.

@markcellus
Copy link
Author

markcellus commented Oct 26, 2022

Perhaps a better way to do this is to create a new error class that extends Error (e.g. PuppeteerExtraPluginRecaptchaError) and just throw that. But I'm not too sure if that would be acceptable here.

@markcellus markcellus changed the title Expose PuppeteerExtraPluginRecaptcha error Expose PuppeteerExtraPluginRecaptcha error Oct 26, 2022
@berstend
Copy link
Owner

berstend commented Feb 27, 2023

Yeah, the error handling isn't optimal 😄
From a quick look it seems that a response.error can be a string or an Error (in which case wrapping it again in an error would cause the info to get lost)

I wonder if this would work as a fix as well:

if (this.opts.throwOnError && response.error) {
  throw !!response.error?.message ? response.error : new Error(response.error)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: puppeteer-extra PuppeteerExtra Plugin related plugin: recaptcha 🏴 reCAPTCHA plugin related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] PuppeteerExtraPluginRecaptcha error has no information and cannot be evaluated
2 participants