You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
473 B
20 lines
473 B
using Services.Failures;
|
|
|
|
namespace Services;
|
|
|
|
public class ServiceException : Exception
|
|
{
|
|
public List<Failure> Failures { get; init; }
|
|
|
|
public ServiceException(params Failure[] failures)
|
|
{
|
|
Failures = new List<Failure>(failures);
|
|
}
|
|
|
|
public Dictionary<string, string[]> FailuresMessages()
|
|
{
|
|
return Failures.GroupBy(f => f.Name)
|
|
.Select(f => (f.Key, f.Select(f => f.Message).ToArray()))
|
|
.ToDictionary();
|
|
}
|
|
} |