59
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
2 Public Class ExceptionWrapper
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
3
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
4 #Region " Declarations "
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
5
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
6 Private _bolIsValidationException As Boolean = False
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
7 Private _enumAction As ValidationErrorEventAction = ValidationErrorEventAction.Added
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
8 Private _objException As Exception
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
9 Private _strControlName As String = String.Empty
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
10
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
11 #End Region
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
12
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
13 #Region " Properties "
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
14
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
15 Public Sub New(ByVal enumAction As ValidationErrorEventAction, ByVal strControlName As String, ByVal objValidationException As Exception)
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
16 _enumAction = enumAction
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
17 _strControlName = strControlName
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
18 _objException = objValidationException
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
19 _bolIsValidationException = True
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
20 End Sub
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
21
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
22 Public ReadOnly Property Action() As ValidationErrorEventAction
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
23 Get
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
24 Return _enumAction
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
25 End Get
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
26 End Property
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
27
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
28 Public ReadOnly Property ControlName() As String
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
29 Get
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
30 Return _strControlName
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
31 End Get
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
32 End Property
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
33
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
34 Public ReadOnly Property Exception() As Exception
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
35 Get
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
36 Return _objException
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
37 End Get
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
38 End Property
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
39
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
40 Public ReadOnly Property IsValidationException() As Boolean
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
41 Get
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
42 Return _bolIsValidationException
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
43 End Get
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
44 End Property
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
45
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
46 #End Region
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
47
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
48 #Region " Constructor "
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
49
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
50 Public Sub New(ByVal objException As Exception)
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
51 _objException = objException
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
52 End Sub
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
53
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
54 #End Region
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
55
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
56 #Region " Methods "
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
57
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
58 Public Overrides Function ToString() As String
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
59
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
60 If _bolIsValidationException Then
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
61 Return String.Format("({0}) - {1}", Me.Action, Exception.Message)
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
62
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
63 Else
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
64 Return Exception.Message
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
65 End If
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
66
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
67 End Function
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
68
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
69 #End Region
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
70
|
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
71 End Class
|