Open markcellus opened 1 year ago
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.
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)
}
Resolves https://github.com/berstend/puppeteer-extra/issues/740 by updating the
PuppeteerExtraPluginRecaptcha
thrown error and exposes all of its properties to be evaluated by consumer code.