using System; namespace AsbCloudApp.Exceptions { /// /// Argument validation fail Exception /// public class ArgumentInvalidException : Exception { public string ParamName { get; } public ArgumentInvalidException(string message, string paramName = default) : base(message) { ParamName = paramName; } public object ToValaidationErrorObject() => MakeValidationError(ParamName, Message); public static object MakeValidationError(string paramName, params string[] errors) => new { name = paramName, errors = errors, }; } }