-
Notifications
You must be signed in to change notification settings - Fork 6
/
Exceptions.cs
281 lines (262 loc) · 10.4 KB
/
Exceptions.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
///
/// SharpWave - A refactored port of JWave
/// https://github.com/graetz23/JWave
///
/// MIT License
///
/// Copyright (c) 2020-2024 Christian ([email protected])
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in all
/// copies or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
/// SOFTWARE.
///
using System;
using SharpWave;
namespace Types
{
/// <summary>
/// Base exception class that any other specific exception class inherit.
/// </summary>
public class Types_Exception : System.Exception
{
public Types_Exception() : base() { }
public Types_Exception(string msg) : base("TYPES." + msg) { }
public Types_Exception(string msg, Exception e) :
base("TYPES." + msg, e) { }
} // class
/// <summary>
/// Error that should be used within this namespace.
/// </summary>
public class Types_Error : Types_Exception
{
public Types_Error() : base() { }
public Types_Error(string msg) : base(msg + " - " + Globals.ERROR) { }
public Types_Error(string msg, Exception e) :
base(msg + " - " + Globals.ERROR, e) { }
} // class
/// <summary>
/// Failure that should be used within this namespace.
/// </summary>
public class Types_Failure : Types_Exception
{
public Types_Failure() : base() { }
public Types_Failure(string msg) : base(msg + " - " + Globals.FAILURE) { }
public Types_Failure(string msg, Exception e) :
base(msg + " - " + Globals.FAILURE, e) { }
} // class
/// <summary>
/// Warning that should be used within this namespace.
/// </summary>
public class Types_Warning : Types_Exception
{
public Types_Warning() : base() { }
public Types_Warning(string msg) : base(msg + " - " + Globals.WARNING) { }
public Types_Warning(string msg, Exception e) :
base(msg + " - " + Globals.WARNING, e) { }
} // class
/// <summary>
/// Irrelevant that should be used within this namespace.
/// </summary>
public class Types_Irrelevant : Types_Exception
{
public Types_Irrelevant() : base() { }
public Types_Irrelevant(string msg) :
base(msg + " - " + Globals.IRRELEVANT) { }
public Types_Irrelevant(string msg, Exception e) :
base(msg + " - " + Globals.IRRELEVANT, e) { }
} // class
/// <summary>
/// Not existent that should be used within this namespace.
/// </summary>
public class Types_NotExistent : Types_Exception
{
public Types_NotExistent() : base() { }
public Types_NotExistent(string msg) :
base(msg + " - " + Globals.NOT_EXISTENT) { }
public Types_NotExistent(string msg, Exception e) :
base(msg + " - " + Globals.NOT_EXISTENT, e) { }
} // class
/// <summary>
/// Not found that should be used within this namespace.
/// </summary>
public class Types_NotFound : Types_Exception
{
public Types_NotFound() : base() { }
public Types_NotFound(string msg) :
base(msg + " - " + Globals.NOT_FOUND) { }
public Types_NotFound(string msg, Exception e) :
base(msg + " - " + Globals.NOT_FOUND, e) { }
} // class
/// <summary>
/// Not valid that should be used within this namespace.
/// </summary>
public class Types_NotValid : Types_Exception
{
public Types_NotValid() : base() { }
public Types_NotValid(string msg) :
base(msg + " - " + Globals.NOT_VALID) { }
public Types_NotValid(string msg, Exception e) :
base(msg + " - " + Globals.NOT_VALID, e) { }
} // class
/// <summary>
/// Not possible that should be used within this namespace.
/// </summary>
public class Types_NotPossible : Types_Exception
{
public Types_NotPossible() : base() { }
public Types_NotPossible(string msg) :
base(msg + " - " + Globals.NOT_POSSIBLE) { }
public Types_NotPossible(string msg, Exception e) :
base(msg + " - " + Globals.NOT_POSSIBLE, e) { }
} // class
/// <summary>
/// Not available that should be used within this namespace.
/// </summary>
public class Types_NotAvailable : Types_Exception
{
public Types_NotAvailable() : base() { }
public Types_NotAvailable(string msg) :
base(msg + " - " + Globals.NOT_AVAILABLE) { }
public Types_NotAvailable(string msg, Exception e) :
base(msg + " - " + Globals.NOT_AVAILABLE, e) { }
} // class
/// <summary>
/// Not implemented that should be used within this namespace.
/// </summary>
public class Types_NotImplemented : Types_Exception
{
public Types_NotImplemented() : base() { }
public Types_NotImplemented(string msg) :
base(msg + " - " + Globals.NOT_IMPLEMENTED) { }
public Types_NotImplemented(string msg, Exception e) :
base(msg + " - " + Globals.NOT_IMPLEMENTED, e) { }
} // class
/// <summary>
/// Base exception class for DATA problematics; any other specific
/// exception class inherits.
/// </summary>
/// <remarks>
/// Hierachical exception that should be used for logical, structural
/// problems in the processed data structure or in case of problematic
/// content.
/// </remarks>
public class Data_Exception : System.Exception
{
public Data_Exception() : base() { }
public Data_Exception(string msg) : base("DATA." + msg) { }
public Data_Exception(string msg, Exception e) :
base("DATA." + msg, e) { }
} // class
/// <summary>
/// Hierachical exception that should be used for logical, structural
/// problems in the processed data structure or in case of problematic
/// content.
/// </summary>
/// <remarks>
/// Use this in general if something went totally wrong and program has
/// to be aborted.
/// </remarks>
public class Data_Error : Data_Exception
{
public Data_Error() : base() { }
public Data_Error(string msg) : base(Globals.ERROR + " " + msg) { }
public Data_Error(string msg, Exception e) :
base(Globals.ERROR + " " + msg, e) { }
} // class
/// <summary>
/// Hierachical exception that should be used for logical, structural
/// problems in the processed data structure or in case of problematic
/// content.
/// </summary>
/// <remarks>
/// Use this in case of some structural / logical inconsistencies that do
/// not bother but may be cleaned up in future releases or versions.
/// </remarks>
public class Data_Warning : Data_Exception
{
public Data_Warning() : base() { }
public Data_Warning(string msg) : base(Globals.WARNING + " " + msg) { }
public Data_Warning(string msg, Exception e) :
base(Globals.WARNING + " " + msg, e) { }
} // class
/// <summary>
/// Hierachical exception that should be used for logical, structural
/// problems in the processed data structure or in case of problematic
/// content.
/// </summary>
/// <remarks>
/// Use this if some logical, strucutural content is additional and
/// uselessfor the performed processing, operation.
/// </remarks>
public class Data_Irrelevant : Data_Exception
{
public Data_Irrelevant() : base() { }
public Data_Irrelevant(string msg) :
base(Globals.IRRELEVANT + " " + msg) { }
public Data_Irrelevant(string msg, Exception e) :
base(Globals.IRRELEVANT + " " + msg, e) { }
} // class
/// <summary>
/// Hierachical exception that should be used for logical, structural
/// problems in the processed data structure or in case of problematic
/// content.
/// </summary>
/// <remarks>
/// Use this if some data is requested and not found in data strucutre.
/// </remarks>
public class Data_NotFound : Data_Exception
{
public Data_NotFound() : base() { }
public Data_NotFound(string msg) : base(Globals.NOT_FOUND + " " + msg) { }
public Data_NotFound(string msg, Exception e) :
base(Globals.NOT_FOUND + " " + msg, e) { }
} // class
/// <summary>
/// Hierachical exception that should be used for logical, structural
/// problems in the processed data structure or in case of problematic
/// content.
/// </summary>
/// <remarks>
/// Use this if some data content can be read in structural ways but the
/// content itself is not available as information; e.g. n/a is placed
/// instead a value.
/// </remarks>
public class Data_NotAvailable : Data_Exception
{
public Data_NotAvailable() : base() { }
public Data_NotAvailable(string msg) :
base(Globals.NOT_AVAILABLE + " " + msg) { }
public Data_NotAvailable(string msg, Exception e) :
base(Globals.NOT_AVAILABLE + " " + msg, e) { }
} // class
/// <summary>
/// Hierachical exception that should be used for logical, structural
/// problems in the processed data structure or in case of problematic
/// content.
/// </summary>
/// <remarks>
/// Use this if content is found that is not valid; e.g. if a value is
/// out of range.
/// </remarks>
public class Data_NotValid : Data_Exception
{
public Data_NotValid() : base() { }
public Data_NotValid(string msg) : base(Globals.NOT_VALID + " " + msg) { }
public Data_NotValid(string msg, Exception e) :
base(Globals.NOT_VALID + " " + msg, e) { }
} // class
} // namespace