using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DiscordRPC.Exceptions { /// /// A StringOutOfRangeException is thrown when the length of a string exceeds the allowed limit. /// public class StringOutOfRangeException : Exception { /// /// Maximum length the string is allowed to be. /// public int MaximumLength { get; private set; } /// /// Minimum length the string is allowed to be. /// public int MinimumLength { get; private set; } /// /// Creates a new string out of range exception with a range of min to max and a custom message /// /// The custom message /// Minimum length the string can be /// Maximum length the string can be internal StringOutOfRangeException(string message, int min, int max) : base(message) { MinimumLength = min; MaximumLength = max; } /// /// Creates a new sting out of range exception with a range of min to max /// /// /// internal StringOutOfRangeException(int minumum, int max) : this("Length of string is out of range. Expected a value between " + minumum + " and " + max, minumum, max) { } /// /// Creates a new sting out of range exception with a range of 0 to max /// /// internal StringOutOfRangeException(int max) : this("Length of string is out of range. Expected a value with a maximum length of " + max, 0, max) { } } }