Skip to content

Commit

Permalink
ValidationResult.ToFail<T>()
Browse files Browse the repository at this point in the history
  • Loading branch information
Anggara Suwartana committed Oct 27, 2018
1 parent 7d9db6e commit 0c1b353
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/IntoItIf.Base/Validations/ValidationResult.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
namespace IntoItIf.Base.Validations
{
using System.Collections.Generic;
using Domain.Options;
using Exceptions;

public sealed class ValidationResult
{
Expand All @@ -19,6 +21,11 @@ public ValidationResult(bool isValid, params string[] errorMessages)
public bool IsValid { get; }
public IEnumerable<string> ErrorMessages { get; }

public Fail<T> ToFail<T>()
{
return Fail<T>.Throw(new ValidationException(ErrorMessages));
}

#endregion
}
}

0 comments on commit 0c1b353

Please sign in to comment.