Domain validation errors must throw domain exceptions.
This commit is contained in:
parent
cea9600227
commit
5fed56db51
@ -1,5 +1,6 @@
|
|||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
using MediatR;
|
using MediatR;
|
||||||
|
using Ordering.Domain.Exceptions;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -33,8 +34,8 @@ namespace Ordering.API.Application.Decorators
|
|||||||
|
|
||||||
if (failures.Any())
|
if (failures.Any())
|
||||||
{
|
{
|
||||||
throw new ValidationException(
|
throw new OrderingDomainException(
|
||||||
$"Command Validation Errors for type {typeof(TRequest).Name}", failures);
|
$"Command Validation Errors for type {typeof(TRequest).Name}", new ValidationException("Validation exception", failures));
|
||||||
}
|
}
|
||||||
|
|
||||||
var response = await _inner.Handle(message);
|
var response = await _inner.Handle(message);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user