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

Apply bail to the whole chain #1290

Open
kratess opened this issue Apr 19, 2024 · 0 comments
Open

Apply bail to the whole chain #1290

kratess opened this issue Apr 19, 2024 · 0 comments

Comments

@kratess
Copy link

kratess commented Apr 19, 2024

Is your feature request related to a problem? Please describe.

using a checkSchema like this:

checkSchema({
  category: {
    notEmpty: {
      bail: true,
      errorMessage: "must not be empty"
    },
    isString: {
      bail: true,
      errorMessage: "must be a string"
    },
    custom: {
      options: async (category, { req }) => {
        if (!req.author.categories.find((cat) => cat.name === category)) {
          throw new Error("not in your permissions");
        }
      }
    }
  }
})

It's redundant to use bail each time.

Describe the solution you'd like

Add a property that instead apply automatically bail to all components of chain.

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

No branches or pull requests

2 participants