-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #1031, return RpcResult for validation exception to avoid retry.
- Loading branch information
Showing
1 changed file
with
2 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bade243
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recently, we want to use validation on the provider side(No issue on the consumer side). But we couldn't get the validation errors on the consumer side when configure the validation="true" to the service on the provider side. It can't parse the exception message by Exceptionhandler, we need ConstraintViolationExeception but it returned the wrapped RemotingException.
Now, we fixed by adding two more files to wrap the message and propertyPath from the hibernate validator, and return to client. The code snippet like::
return new RpcResult(new RpcException(new CustomViolationException(set)));
Then the exception handler can handle this RpcException, and retrieve the message & propertyPath from CustomViolationException.