All checks were successful
Build and Deploy LSFE / build-and-deploy (push) Successful in 1m43s
21 lines
591 B
C#
21 lines
591 B
C#
using FluentValidation.Results;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace LSFE.Application.Common.Exceptions
|
|
{
|
|
public class ValidationException : Exception
|
|
{
|
|
public IDictionary<string, string[]> Errors { get; }
|
|
|
|
public ValidationException(IEnumerable<ValidationFailure> failures)
|
|
: base("One or more validation errors occurred.")
|
|
{
|
|
Errors = failures
|
|
.GroupBy(f => f.PropertyName, f => f.ErrorMessage)
|
|
.ToDictionary(g => g.Key, g => g.ToArray());
|
|
}
|
|
}
|
|
}
|