private static string formatMessage(ThrottleExceptionType type, int minutes) { var minutesPlural = "minutes"; if (minutes < 2) { minutesPlural = "minute"; } switch (type) { case ThrottleExceptionType.Login: return(string.Format("You've exceeded the maximum login requests. Please wait {0} " + minutesPlural + " and then try again. If you didn't attempt multiple logins, please send an email to [email protected]", minutes)); case ThrottleExceptionType.RestPassword: return(string.Format("You've exceeded the maximum reset requests. Please wait {0} " + minutesPlural + " and then try again. If you didn't attempt multiple password resets, please send an email to [email protected]", minutes)); case ThrottleExceptionType.Signup: return(string.Format("You've exceeded the maximum signup requests. Please wait {0} " + minutesPlural + " and then try again. If you didn't attempt multiple signups, please send an email to [email protected]", minutes)); } return(null); }
public ThrottleException(ThrottleExceptionType type, int minutes) : base(formatMessage(type, minutes)) { }