Furry / 2captcha

A wrapper around the 2captcha api
71 stars 23 forks source link

Please expose custom error class #3

Closed moltar closed 3 years ago

moltar commented 3 years ago

Would be useful to have the error class exported: https://github.com/Furry/2captcha/blob/master/src/structs/2captchaError.ts

This way we can do:

if (err instanceof APIError && err.code === 1) {
  /// handle error
}

Thanks.

moltar commented 3 years ago

Right now, as a workaround, we can do:

import { APIError } from '2captcha/dist/structs/2captchaError'
Furry commented 3 years ago

Hiya, thanks for the issue! I added API error as a primary export from 'index' along with Solver.

2ceb22e4152bedc4162b9badff219c8b70ee5398 It's useable on the latest version of 2captcha from NPM, 2captcha@2.1.4

moltar commented 3 years ago

Thank you!