You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there any way to customize the exception message?
In my middleware, I'm validating input and catching ValidationFailure exception. Then, from the previous exception, I'm able to extract f.e. KeywordMismatch exception, get the path to the property that failed, and also return a generic exception message.
It would be helpful to have the option to customize the validation exception message. I found it a bit generic, especially for Enum validation - the generic message is Value must be present in the enum but I want to return also possible values (since spec file is not published yet - it covers only a few endpoints and it is not ready to be published).
I've checked the source code and didn't find any clues on how to achieve that.
Maybe there is a way to get failed property from exception and customize the such message by extracting from Schema by path, method, and breadcrumbs?
The text was updated successfully, but these errors were encountered:
Is there any way to customize the exception message?
In my middleware, I'm validating input and catching ValidationFailure exception. Then, from the previous exception, I'm able to extract f.e. KeywordMismatch exception, get the path to the property that failed, and also return a generic exception message.
It would be helpful to have the option to customize the validation exception message. I found it a bit generic, especially for Enum validation - the generic message is
Value must be present in the enum
but I want to return also possible values (since spec file is not published yet - it covers only a few endpoints and it is not ready to be published).I've checked the source code and didn't find any clues on how to achieve that.
Maybe there is a way to get failed property from exception and customize the such message by extracting from Schema by path, method, and breadcrumbs?
The text was updated successfully, but these errors were encountered: