/// <summary> /// Dispara uma exception caso o resultado informado seja inválido. /// </summary> /// <param name="validationResult"></param> public static void ThrowInvalid(this ValidationQueryResult validationResult) { if (validationResult != null && !validationResult) { throw new InvalidQueryResultException(validationResult); } }
/// <summary> /// Formata mensagem do erro. /// </summary> /// <param name="result"></param> /// <returns></returns> private static string FormatMessage(ValidationQueryResult result) { return(string.Format("({0}) {1}", result.Error, result.Message.Format())); }
/// <summary> /// Construtor padrão. /// </summary> /// <param name="result"></param> public InvalidQueryResultException(ValidationQueryResult result) : base(FormatMessage(result)) { _error = result.Error; }