1
|
|
|
2
|
|
#region Apache Notice
|
3
|
|
|
4
|
|
|
5
|
|
|
6
|
|
|
7
|
|
|
8
|
|
|
9
|
|
|
10
|
|
|
11
|
|
|
12
|
|
|
13
|
|
|
14
|
|
|
15
|
|
|
16
|
|
|
17
|
|
|
18
|
|
|
19
|
|
|
20
|
|
|
21
|
|
|
22
|
|
|
23
|
|
|
24
|
|
|
25
|
|
#endregion
|
26
|
|
|
27
|
|
#region Using
|
28
|
|
|
29
|
|
using System.Text;
|
30
|
|
|
31
|
|
#endregion
|
32
|
|
|
33
|
|
namespace IBatisNet.DataMapper.Scope
|
34
|
|
{
|
35
|
|
|
36
|
|
|
37
|
|
|
38
|
|
public class ErrorContext
|
39
|
|
{
|
40
|
|
|
41
|
|
#region Fields
|
42
|
|
|
43
|
|
private string _resource = string.Empty;
|
44
|
|
private string _activity = string.Empty;
|
45
|
|
private string _objectId = string.Empty;
|
46
|
|
private string _moreInfo = string.Empty;
|
47
|
|
#endregion
|
48
|
|
|
49
|
|
#region Properties
|
50
|
|
|
51
|
|
|
52
|
|
|
53
|
|
|
54
|
|
public string Resource
|
55
|
|
{
|
56
|
0
|
get { return _resource; }
|
57
|
4930
|
set { _resource = value; }
|
58
|
|
}
|
59
|
|
|
60
|
|
|
61
|
|
|
62
|
|
|
63
|
|
public string Activity
|
64
|
|
{
|
65
|
0
|
get { return _activity; }
|
66
|
34850
|
set { _activity = value; }
|
67
|
|
}
|
68
|
|
|
69
|
|
|
70
|
|
|
71
|
|
|
72
|
|
public string ObjectId
|
73
|
|
{
|
74
|
0
|
get { return _objectId; }
|
75
|
40460
|
set { _objectId = value; }
|
76
|
|
}
|
77
|
|
|
78
|
|
|
79
|
|
|
80
|
|
|
81
|
|
public string MoreInfo
|
82
|
|
{
|
83
|
0
|
get { return _moreInfo; }
|
84
|
239554
|
set { _moreInfo = value; }
|
85
|
|
}
|
86
|
|
|
87
|
|
#endregion
|
88
|
|
|
89
|
|
#region Methods
|
90
|
|
|
91
|
|
|
92
|
|
|
93
|
|
|
94
|
3230
|
public void Reset()
|
95
|
|
{
|
96
|
3230
|
_resource = string.Empty;
|
97
|
3230
|
_activity = string.Empty;
|
98
|
3230
|
_objectId = string.Empty;
|
99
|
3230
|
_moreInfo = string.Empty;
|
100
|
|
}
|
101
|
|
|
102
|
|
|
103
|
|
|
104
|
|
|
105
|
|
|
106
|
0
|
public override string ToString()
|
107
|
|
{
|
108
|
|
StringBuilder message = new StringBuilder();
|
109
|
|
|
110
|
|
|
111
|
|
if (_activity != null && _activity.Length > 0)
|
112
|
|
{
|
113
|
|
message.Append("\n- The error occurred while ");
|
114
|
|
message.Append(_activity);
|
115
|
|
message.Append(".");
|
116
|
|
}
|
117
|
|
|
118
|
|
|
119
|
|
if (_moreInfo != null && _moreInfo.Length > 0)
|
120
|
|
{
|
121
|
|
message.Append("\n- ");
|
122
|
|
message.Append(_moreInfo);
|
123
|
|
}
|
124
|
|
|
125
|
|
|
126
|
|
if (_resource != null && _resource.Length > 0)
|
127
|
|
{
|
128
|
|
message.Append("\n- The error occurred in ");
|
129
|
|
message.Append(_resource);
|
130
|
|
message.Append(".");
|
131
|
|
}
|
132
|
|
|
133
|
|
|
134
|
|
if (_objectId != null && _objectId.Length > 0)
|
135
|
|
{
|
136
|
|
message.Append(" \n- Check the ");
|
137
|
|
message.Append(_objectId);
|
138
|
|
message.Append(".");
|
139
|
|
}
|
140
|
|
|
141
|
|
return message.ToString();
|
142
|
|
}
|
143
|
|
|
144
|
|
#endregion
|
145
|
|
|
146
|
|
}
|
147
|
|
}
|
148
|
|
|