/// <summary> /// Create a new instance of <see cref="ValidationException"/>. /// </summary> /// <param name="options"></param> public ValidationException(CosmosExceptionOptions options) : base(options) { if (options != null && options.ExtraErrors.TryGetValue(ValidationMessageInfoKey, out var value) && value is IEnumerable <string> messages) { _validationMessage = messages; } }
public static void Require3 <TException>(bool assertion, CosmosExceptionOptions options) where TException : CosmosException { if (assertion) { return; } if (options == null) { throw new ArgumentNullException(nameof(options)); } var exception = Types.CreateInstance <TException>(options); throw exception; }
/// <summary> /// Require. /// </summary> /// <typeparam name="TException">Special type TException.</typeparam> /// <param name="assertion">Predicate.</param> /// <param name="options">Cosmos exception options.</param> public static void Require3 <TException>(bool assertion, CosmosExceptionOptions options) where TException : CosmosException { if (assertion) { return; } Exception exception; if (options is null) { exception = new ArgumentNullException(nameof(options)); } else { exception = Reflection.Types.CreateInstance <TException>(options); } Exceptions.ExceptionHelper.PrepareForRethrow(exception); }