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

How to display external error in parallel with Joi asyncValidation ?? #2783

Open
ro-pal opened this issue May 16, 2022 · 5 comments
Open

How to display external error in parallel with Joi asyncValidation ?? #2783

ro-pal opened this issue May 16, 2022 · 5 comments
Assignees

Comments

@ro-pal
Copy link

ro-pal commented May 16, 2022

Hey is it possible to return own external validation error like - check isLoginExist in DB and if there is, return error with with Joi Errors ? For now, I am showing that error after all of them from Joi. If password & confirmedPassword don't match the Joi validation is informing about that but not about isLoginTaken. After corrected password matches the isLoginExist error will be returned. Is it possible ??

@Marsup
Copy link
Collaborator

Marsup commented May 18, 2022

I don't understand your issue at all. Show an example of what you want maybe? And next time, don't ignore the issue template, it's there for a reason.

@Marsup Marsup self-assigned this May 18, 2022
@ro-pal
Copy link
Author

ro-pal commented May 18, 2022

Thanks for your reply. Sorry, I'll pay attention to it next time and won't ignore issue template.
I meant that I am trying to return errors from my validation which I put to the external() method together with errors from Joi.
When I am sending that set of data to DB:

{
    "login": "User1",
    "password": "Password1",
    "passwordConfirmation": "Password"
}

And if login exists in DB I will get error about mismatch password.
When I will put match password, and make post again.

{
   "login": "User1",
   "password": "Password1",
   "passwordConfirmation": "Password1"
}

I will get error about user exists in DB.
That what I want to achive is displaing error from validation about login or email exists in db together with Joi validation errors. Do u know what I mean ?

@Marsup
Copy link
Collaborator

Marsup commented May 18, 2022

Right now you can't, external immediately throws your error.

@ro-pal
Copy link
Author

ro-pal commented May 18, 2022

Do u mean. It doesn't possible ??

@asologor
Copy link

There's a PR for it #2773. Seems like everyone ignores it.

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

3 participants