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

Re-export AsyncValidationError in the build result #326

Open
imballinst opened this issue Dec 29, 2022 · 0 comments
Open

Re-export AsyncValidationError in the build result #326

imballinst opened this issue Dec 29, 2022 · 0 comments

Comments

@imballinst
Copy link

Hello, thank you for creating this library!

I wonder if we can re-export AsyncValidationError in this line?

import {
format,
complementError,
asyncMap,
warning,
deepMerge,
convertFieldsError,
} from './util';

Something like this:

export { AsyncValidationError } from './util'

This is so that, if we use it with async/await, we can do something like this, similar like what we usually do with axios and AxiosError:

import { AsyncValidationError } from 'async-validator'

try {
  await schema.validate(...)
} catch (err) {
  if (err instanceof AsyncValidationError) {
    // Do stuff...
  }
}

I can open a PR if it's possible, let me know what you think. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant