I thought that the Send() method of the ServiceGateway will throw a exception of type WebServiceException in case of error
Documentation:
[…] One noticeable difference is that any Exceptions thrown by downstream Services are automatically converted into the same
WebServiceException
that clients would throw when calling the Service externally […]
But when I try to POST a poco with validation rules and that validation fails, it throws a AggregateException instead (the WebServiceException is the only element in the InnerExceptions collection)
Is this supposed to work like that ?
Thank you
// In my controller
...
Gateway.Send(new MyPoco()); // throws AggregateException
...
// My Poco
public class MyPoco : IPost
{
public string Prop1 { get; set; }
}
// My validator
public class MyPocoValidator : AbstractValidator<MyPoco>
{
public MyPocoValidator()
{
RuleFor(x => x.Prop1).NotEmpty();
}
}