-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOperationValidationError.cs
50 lines (43 loc) · 1.65 KB
/
OperationValidationError.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
namespace Deveel
{
/// <summary>
/// An error that occurred during the validation of an operation.
/// </summary>
public readonly struct OperationValidationError : IValidationError
{
/// <summary>
/// Constructs an instance of an <see cref="OperationValidationError"/> object.
/// </summary>
/// <param name="code">
/// The code of the error, that is unique within the
/// given domain.
/// </param>
/// <param name="domain">
/// The domain where the error occurred.
/// </param>
/// <param name="validationResults">
/// A list of validation results that caused the error.
/// </param>
public OperationValidationError(string code, string domain, IReadOnlyList<ValidationResult> validationResults)
{
ArgumentNullException.ThrowIfNull(code, nameof(code));
ArgumentNullException.ThrowIfNull(domain, nameof(domain));
ArgumentNullException.ThrowIfNull(validationResults, nameof(validationResults));
Code = code;
Domain = domain;
ValidationResults = validationResults;
}
/// <inheritdoc/>
public IReadOnlyList<ValidationResult> ValidationResults { get; }
/// <inheritdoc/>
public string Code { get; }
/// <inheritdoc/>
public string Domain { get; }
[ExcludeFromCodeCoverage]
string? IOperationError.Message => null;
[ExcludeFromCodeCoverage]
IOperationError? IOperationError.InnerError => null;
}
}