DD.WellWorkover.Cloud/AsbCloudApp/Exceptions/ArgumentInvalidException.cs

43 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
namespace AsbCloudApp.Exceptions
{
/// <summary>
/// Argument validation fail Exception
/// </summary>
public class ArgumentInvalidException : Exception
{
/// <summary>
/// название аргумента
/// </summary>
public IDictionary<string, string[]> ParamsNames { get; } = null!;
/// <summary>
/// конструктор
/// </summary>
/// <param name="paramName"></param>
/// <param name="message"></param>
public ArgumentInvalidException(string paramName, string message)
: base(message)
{
ParamsNames = new Dictionary<string, string[]>() {
{ paramName, new[]{ message } }
};
}
/// <summary>
/// конструктор
/// </summary>
/// <param name="paramsNames"></param>
/// <param name="message"></param>
public ArgumentInvalidException(string[] paramsNames, string message)
: base(message)
{
ParamsNames = new Dictionary<string, string[]>() {
{ string.Join(", ", paramsNames), new[]{ message } }
};
}
}
}