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

43 lines
1.2 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
namespace AsbCloudApp.Exceptions
{
/// <summary>
/// Argument validation fail Exception
/// </summary>
public class ArgumentInvalidException : Exception
{
2022-06-02 12:35:51 +05:00
/// <summary>
/// название аргумента
/// </summary>
public IDictionary<string, string[]> ParamsNames { get; } = null!;
2022-06-02 12:35:51 +05:00
/// <summary>
/// конструктор
/// </summary>
/// <param name="paramName"></param>
2023-09-29 12:06:46 +05:00
/// <param name="message"></param>
public ArgumentInvalidException(string paramName, string message)
2022-04-11 18:00:34 +05:00
: 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 } }
};
}
}
}