-
Notifications
You must be signed in to change notification settings - Fork 2
/
DomainValidationException.cs
51 lines (43 loc) · 1.39 KB
/
DomainValidationException.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
51
using My.Core.Exceptions;
namespace Records.Shared.Domain.Exceptions;
/// <summary>
/// Base exception to represent validations domain errors.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage(
"Design",
"CA1032:Implement standard exception constructors",
Justification = "We want to use this constructor only.")]
public class DomainValidationException : ValidationException
{
#region Contructor
/// <summary>
/// Initializes a new instance of the <see cref="DomainException"/> class.
/// </summary>
/// <param name="message">The message.</param>
public DomainValidationException(string message)
: base(message)
{
SetDefaultErrorGroup();
}
/// <summary>
/// Initializes a new instance of the <see cref="DomainException"/> class.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="innerException">The inner exception.</param>
public DomainValidationException(string message, Exception innerException)
: base(message, innerException)
{
SetDefaultErrorGroup();
}
#endregion
#region Methods
/// <summary>
/// Set the erroGroup for validations.
/// </summary>
private void SetDefaultErrorGroup()
{
// The ExDataKey.ErrorCode is set in the base class.
Data[ExDataKey.ErrorGroup] = "DomainValidation";
}
#endregion
}