0
|
1 using System;
|
|
2 using System.Runtime.Serialization;
|
|
3
|
|
4 namespace BLToolkit.Validation
|
|
5 {
|
|
6 /// <summary>
|
|
7 /// Defines the base class for the namespace exceptions.
|
|
8 /// </summary>
|
|
9 /// <remarks>
|
|
10 /// This class is the base class for exceptions that may occur during
|
|
11 /// execution of the namespace members.
|
|
12 /// </remarks>
|
|
13 [Serializable]
|
|
14 public class ValidationException : Exception
|
|
15 {
|
|
16 /// <summary>
|
|
17 /// Initializes a new instance of the <see cref="ValidationException"/> class.
|
|
18 /// </summary>
|
|
19 /// <remarks>
|
|
20 /// This constructor initializes the <see cref="Exception.Message"/>
|
|
21 /// property of the new instance such as "A Validation exception has occurred."
|
|
22 /// </remarks>
|
|
23 public ValidationException()
|
|
24 : base("A Validation exception has occurred.")
|
|
25 {
|
|
26 }
|
|
27
|
|
28 /// <summary>
|
|
29 /// Initializes a new instance of the <see cref="ValidationException"/> class
|
|
30 /// with the specified error message.
|
|
31 /// </summary>
|
|
32 /// <param name="message">The message to display to the client when the
|
|
33 /// exception is thrown.</param>
|
|
34 /// <seealso cref="Exception.Message"/>
|
|
35 public ValidationException(string message)
|
|
36 : base(message)
|
|
37 {
|
|
38 }
|
|
39
|
|
40 /// <summary>
|
|
41 /// Initializes a new instance of the <see cref="ValidationException"/> class
|
|
42 /// with the specified error message and InnerException property.
|
|
43 /// </summary>
|
|
44 /// <param name="message">The message to display to the client when the
|
|
45 /// exception is thrown.</param>
|
|
46 /// <param name="innerException">The InnerException, if any, that threw
|
|
47 /// the current exception.</param>
|
|
48 /// <seealso cref="Exception.Message"/>
|
|
49 /// <seealso cref="Exception.InnerException"/>
|
|
50 public ValidationException(string message, Exception innerException)
|
|
51 : base(message, innerException)
|
|
52 {
|
|
53 }
|
|
54
|
|
55 /// <summary>
|
|
56 /// Initializes a new instance of the <see cref="ValidationException"/> class
|
|
57 /// with the specified InnerException property.
|
|
58 /// </summary>
|
|
59 /// <param name="innerException">The InnerException, if any, that threw
|
|
60 /// the current exception.</param>
|
|
61 /// <seealso cref="Exception.Message"/>
|
|
62 /// <seealso cref="Exception.InnerException"/>
|
|
63 public ValidationException(Exception innerException)
|
|
64 : base(innerException.Message, innerException)
|
|
65 {
|
|
66 }
|
|
67
|
|
68 #if !SILVERLIGHT
|
|
69
|
|
70 /// <summary>
|
|
71 /// Initializes a new instance of the <see cref="ValidationException"/> class
|
|
72 /// with serialized data.
|
|
73 /// </summary>
|
|
74 /// <param name="info">The object that holds the serialized object data.</param>
|
|
75 /// <param name="context">The contextual information about the source or
|
|
76 /// destination.</param>
|
|
77 /// <remarks>This constructor is called during deserialization to
|
|
78 /// reconstitute the exception object transmitted over a stream.</remarks>
|
|
79 protected ValidationException(SerializationInfo info, StreamingContext context)
|
|
80 : base(info, context)
|
|
81 {
|
|
82 }
|
|
83
|
|
84 #endif
|
|
85 }
|
|
86 }
|