Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GaussianProcessTuning/ILNumerics.2.14.4735.573/Misc/ILException.cs @ 12448

Last change on this file since 12448 was 9102, checked in by gkronber, 12 years ago

#1967: ILNumerics source for experimentation

File size: 10.9 KB
Line 
1///
2///    This file is part of ILNumerics Community Edition.
3///
4///    ILNumerics Community Edition - high performance computing for applications.
5///    Copyright (C) 2006 - 2012 Haymo Kutschbach, http://ilnumerics.net
6///
7///    ILNumerics Community Edition is free software: you can redistribute it and/or modify
8///    it under the terms of the GNU General Public License version 3 as published by
9///    the Free Software Foundation.
10///
11///    ILNumerics Community Edition is distributed in the hope that it will be useful,
12///    but WITHOUT ANY WARRANTY; without even the implied warranty of
13///    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14///    GNU General Public License for more details.
15///
16///    You should have received a copy of the GNU General Public License
17///    along with ILNumerics Community Edition. See the file License.txt in the root
18///    of your distribution package. If not, see <http://www.gnu.org/licenses/>.
19///
20///    In addition this software uses the following components and/or licenses:
21///
22///    =================================================================================
23///    The Open Toolkit Library License
24///   
25///    Copyright (c) 2006 - 2009 the Open Toolkit library.
26///   
27///    Permission is hereby granted, free of charge, to any person obtaining a copy
28///    of this software and associated documentation files (the "Software"), to deal
29///    in the Software without restriction, including without limitation the rights to
30///    use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
31///    the Software, and to permit persons to whom the Software is furnished to do
32///    so, subject to the following conditions:
33///
34///    The above copyright notice and this permission notice shall be included in all
35///    copies or substantial portions of the Software.
36///
37///    =================================================================================
38///   
39
40using System;
41
42namespace ILNumerics.Exceptions
43{
44    /// <summary>
45    /// Generic exception, base class for all exceptions thrown by ILNumerics
46    /// </summary>
47    public class ILException : System.Exception
48    {
49        /// <summary>
50        /// Constructor
51        /// </summary>
52        /// <param name="message">Additional message to be included</param>
53        public ILException(String message) : base(message) { }
54        /// <summary>
55        /// Constructor
56        /// </summary>
57        /// <param name="message">Additional message to be included</param>
58        /// <param name="innerException">Inner Exception</param>
59        public ILException(String message, Exception innerException)
60                : base(message, innerException) { }
61    }
62    /// <summary>
63    /// Base class for mathematical exceptions. Needed e.g. in interpreter for proper error
64    /// messages
65    /// </summary>
66    public class ILMathException : ILException
67    {
68        /// <summary>
69        /// Constructor
70        /// </summary>
71        /// <param name="message">Additional message to be included</param>
72        public ILMathException(String message) : base(message) { }
73        /// <summary>
74        /// Constructor
75        /// </summary>
76        /// <param name="message">Additional message to be included</param>
77        /// <param name="innerException">Inner Exception</param>
78        public ILMathException(String message, Exception innerException)
79                : base(message, innerException) { }
80    }
81
82    /// <summary>
83    /// One of the most common exceptions: The matrix sizes do not match
84    /// </summary>
85    public class ILDimensionMismatchException : ILMathException
86    {
87        /// <summary>
88        /// Constructor
89        /// </summary>
90        public ILDimensionMismatchException() : base("Matrix dimensions must match") { }
91        /// <summary>
92        /// Constructor
93        /// </summary>
94        /// <param name="message">Additional message to be included</param>
95        /// <param name="innerException">Inner Exception</param>
96        public ILDimensionMismatchException(String message, Exception innerException)
97                : base(message, innerException) { }
98        /// <summary>
99        /// Constructor
100        /// </summary>
101        /// <param name="message">Additional message to be included</param>
102        public ILDimensionMismatchException(string message) : base(message) { }
103    }
104
105    /// <summary>
106    /// Something was wrong with the arguments supplied
107    /// </summary>
108    public class ILArgumentException : ILException {
109        /// <summary>
110        /// Constructor
111        /// </summary>
112        /// <param name="message">Additional message to be included</param>
113        public ILArgumentException(String message)
114            : base(message) {}
115        /// <summary>
116        /// Constructor
117        /// </summary>
118        /// <param name="message">Additional message to be included</param>
119        /// <param name="innerException">Inner Exception</param>
120        public ILArgumentException(String message, Exception innerException)
121                : base(message, innerException) { }
122    }
123    /// <summary>
124    /// A function was called with the wrong number of arguments
125    /// </summary>
126    public class ILArgumentNumberException : ILArgumentException {
127        /// <summary>
128        /// Constructor
129        /// </summary>
130        /// <param name="message">Additional message to be included</param>
131        public ILArgumentNumberException(String message)
132            : base(message) { }
133        /// <summary>
134        /// Constructor
135        /// </summary>
136        /// <param name="message">Additional message to be included</param>
137        /// <param name="innerException">Inner Exception</param>
138        public ILArgumentNumberException(String message, Exception innerException)
139            : base(message, innerException) { }
140    }
141    /// <summary>
142    /// A function argument has the wrong size
143    /// </summary>
144    public class ILArgumentSizeException : ILArgumentException {
145        /// <summary>
146        /// Constructor
147        /// </summary>
148        /// <param name="message">Additional message to be included</param>
149        public ILArgumentSizeException(String message)
150            : base(message) { }
151        /// <summary>
152        /// Constructor
153        /// </summary>
154        /// <param name="message">Additional message to be included</param>
155        /// <param name="innerException">Inner Exception</param>
156        public ILArgumentSizeException(String message, Exception innerException)
157            : base(message, innerException) { }
158    }
159    /// <summary>
160    /// A function was called with a wrong argument type
161    /// </summary>
162    /// <remarks>This exception might be thrown if the size or inner
163    /// type of a argument is invalid. (e.g. matrix expected, but 3D array found)
164    /// </remarks>
165    public class ILArgumentTypeException : ILArgumentException {
166        /// <summary>
167        /// Constructor
168        /// </summary>
169        /// <param name="message">Additional message to be included</param>
170        public ILArgumentTypeException(String message)
171            : base(message) {}
172        /// <summary>
173        /// Constructor
174        /// </summary>
175        /// <param name="message">Additional message to be included</param>
176        /// <param name="innerException">Inner Exception</param>
177         public ILArgumentTypeException(String message, Exception innerException)
178                : base(message, innerException) { }
179    }
180   
181    /// <summary>
182    /// A request could not be completed due to not enough memory available
183    /// </summary>
184    public class ILMemoryException : ILException {
185        /// <summary>
186        /// Constructor
187        /// </summary>
188        /// <param name="message">Additional message to be included</param>
189        public ILMemoryException(String message)
190            : base(message) {}
191        /// <summary>
192        /// Constructor
193        /// </summary>
194        /// <param name="message">Additional message to be included</param>
195        /// <param name="innerException">Inner Exception</param>
196        public ILMemoryException(String message, Exception innerException)
197                : base(message, innerException) { }
198    }
199    /// <summary>
200    /// Thrown on illegal casting attempts
201    /// </summary>
202    public class ILCastException : ILException
203    {
204        /// <summary>
205        /// Costructor
206        /// </summary>
207        /// <param name="message">Addditional message to be included into the exception</param>
208        public ILCastException(String message)
209            : base(message) { }
210        /// <summary>
211        /// Costructor
212        /// </summary>
213        /// <param name="message">Additional message to be included into the exception</param>
214        /// <param name="innerException">On cascaded exception handling, the exception catched before</param>
215        public ILCastException(String message, Exception innerException)
216            : base(message, innerException) { }
217    }
218    /// <summary>
219    /// ILOutputException, thrown if an I/O attempt fails
220    /// </summary>
221    public class ILOutputException : ILException
222    {
223        /// <summary>
224        /// Constructor
225        /// </summary>
226        /// <param name="message">Additional message to be included</param>
227        public ILOutputException(String message)
228            : base(message) { }
229        /// <summary>
230        /// Constructor
231        /// </summary>
232        /// <param name="message">Additional message to be included</param>
233        /// <param name="innerException">Inner Exception</param>
234        public ILOutputException(String message, Exception innerException)
235            : base(message, innerException) { }
236    }
237
238    /// <summary>
239    /// Exception thrown if an operation could not completed
240    /// </summary>
241    public class ILInvalidOperationException : ILException
242    {
243        /// <summary>
244        /// Constructor
245        /// </summary>
246        /// <param name="message">Additional message to be included</param>
247        public ILInvalidOperationException(String message)
248            : base(message) {}
249        /// <summary>
250        /// Constructor
251        /// </summary>
252        /// <param name="message">Additional message to be included</param>
253        /// <param name="innerException">Inner Exception</param>
254        public ILInvalidOperationException(String message, Exception innerException)
255                : base(message, innerException) { }
256    }
257    /// <summary>
258    /// No valid license could be found
259    /// </summary>
260    public class ILInvalidLicenseException : ILException {
261        /// <summary>
262        /// Create a new ILInvalidLicenseException
263        /// </summary>
264        /// <param name="message">Additional message to be included</param>
265        public ILInvalidLicenseException(String message, Exception innerExc)
266            : base(message, innerExc) {}
267    }
268}
Note: See TracBrowser for help on using the repository browser.