Mantid
Loading...
Searching...
No Matches
Exception.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
12#include "MantidKernel/DllConfig.h"
13#include <exception>
14#include <stdexcept>
15#include <string>
16
17namespace Mantid {
18namespace Kernel {
95namespace Exception {
96
98class MANTID_KERNEL_DLL FileError : public std::runtime_error {
99private:
101 const std::string fileName;
103 std::string outMessage;
104
105public:
106 FileError(const std::string &Desc, std::string FName);
107 FileError(const FileError &A);
110 const char *what() const noexcept override;
111};
112
115class MANTID_KERNEL_DLL ParseError final : public FileError {
116private:
118 const int m_lineNumber;
120 std::string m_outMessage;
121
122public:
129 ParseError(const std::string &desc, const std::string &fileName, const int &lineNumber);
131 ParseError(const ParseError &A);
134 const char *what() const noexcept override;
135};
136
138class MANTID_KERNEL_DLL NotImplementedError final : public std::logic_error {
139public:
140 NotImplementedError(const std::string &);
141 const char *what() const noexcept override;
142};
143
145class MANTID_KERNEL_DLL NotFoundError final : public std::runtime_error {
146private:
148 const std::string objectName;
150 std::string outMessage;
151
152public:
153 NotFoundError(const std::string &, std::string);
154 NotFoundError(const std::string &, const int &);
155 NotFoundError(const std::string &, const int64_t &);
156 NotFoundError(const std::string &, const std::size_t &);
160 const char *what() const noexcept override;
161};
162
164class MANTID_KERNEL_DLL ExistsError final : public std::runtime_error {
165private:
167 const std::string objectName;
169 std::string outMessage;
170
171public:
172 ExistsError(const std::string &, std::string);
173 ExistsError(const ExistsError &A);
176
177 const char *what() const noexcept override;
178};
179
202class MANTID_KERNEL_DLL AbsObjMethod : public std::runtime_error {
203private:
205 const std::string objectName;
207 std::string outMessage;
208
209public:
210 AbsObjMethod(std::string);
211 AbsObjMethod(const AbsObjMethod &A);
214
215 const char *what() const noexcept override;
216};
217
220class MANTID_KERNEL_DLL InstrumentDefinitionError : public std::runtime_error {
221private:
223 const std::string objectName;
225 std::string outMessage;
226
227public:
228 InstrumentDefinitionError(const std::string &, std::string);
229 InstrumentDefinitionError(const std::string &);
233
234 const char *what() const noexcept override;
235};
236
240class MANTID_KERNEL_DLL OpenGLError : public std::runtime_error {
241private:
243 const std::string objectName;
245 std::string outMessage;
246
247public:
248 OpenGLError(const std::string &, std::string);
249 OpenGLError(const std::string &);
250 OpenGLError(const OpenGLError &A);
253
254 const char *what() const noexcept override;
255};
263template <typename T> class MisMatch : public std::runtime_error {
264private:
265 const T Aval;
266 const T Bval;
267 std::string m_message;
268
269public:
270 MisMatch(const T &, const T &, const std::string &);
271 MisMatch(const MisMatch<T> &A);
273
275 const char *what() const noexcept override;
276};
277
284class MANTID_KERNEL_DLL IndexError : public std::runtime_error {
285private:
286 const size_t Val;
287 const size_t maxVal;
288 std::string m_message;
289
290public:
291 // Unsigned versions
292 IndexError(const size_t V, const size_t B, const std::string &Place);
293 IndexError(const IndexError &A);
295
297 const char *what() const noexcept override;
298};
299
305class MANTID_KERNEL_DLL NullPointerException : public std::runtime_error {
306private:
308 const std::string outMessage;
309
310public:
311 NullPointerException(const std::string &place, const std::string &objectName);
313 const char *what() const noexcept override;
314};
315
321class MANTID_KERNEL_DLL InternetError final : public std::runtime_error {
322private:
324 std::string outMessage;
326
327public:
328 InternetError(const std::string &message, const int &errorCode = 0);
330 const char *what() const noexcept override;
331 const int &errorCode() const;
332};
333
336class MANTID_KERNEL_DLL FitSizeWarning final : public std::exception {
337 std::string m_message;
338
339public:
340 explicit FitSizeWarning(size_t oldSize);
341 FitSizeWarning(size_t oldSize, size_t newSize);
342 const char *what() const noexcept override;
343};
344
345} // namespace Exception
346} // namespace Kernel
347} // namespace Mantid
const std::vector< double > & rhs
Exception for a call to an abstract class function.
Definition: Exception.h:202
std::string outMessage
The message returned by what()
Definition: Exception.h:207
const std::string objectName
The name of the search object.
Definition: Exception.h:205
AbsObjMethod & operator=(const AbsObjMethod &A)
Assignment operator.
Exception for when an item is already in a collection.
Definition: Exception.h:164
ExistsError & operator=(const ExistsError &A)
Assignment operator.
std::string outMessage
The message returned by what()
Definition: Exception.h:169
const std::string objectName
The name of the search object.
Definition: Exception.h:167
Records the filename and the description of failure.
Definition: Exception.h:98
const std::string fileName
The name of the file relating to the error.
Definition: Exception.h:101
FileError & operator=(const FileError &A)
Assignment operator.
std::string outMessage
The message returned by what()
Definition: Exception.h:103
Exception thrown when a fitting function changes number of parameters during fit.
Definition: Exception.h:336
Exception for index errors.
Definition: Exception.h:284
const size_t Val
Actual value called.
Definition: Exception.h:286
const size_t maxVal
Maximum value.
Definition: Exception.h:287
std::string m_message
The message reported by what()
Definition: Exception.h:288
IndexError & operator=(const IndexError &A)
Exception for errors associated with the instrument definition.
Definition: Exception.h:220
InstrumentDefinitionError & operator=(const InstrumentDefinitionError &A)
Assignment operator.
std::string outMessage
The message returned by what()
Definition: Exception.h:225
const std::string objectName
The name of the search object.
Definition: Exception.h:223
Exception thrown when error occurs accessing an internet resource.
Definition: Exception.h:321
int m_errorCode
The message reported by what()
Definition: Exception.h:325
std::string outMessage
The message returned by what()
Definition: Exception.h:324
Error when two numbers should be identical (or close)
Definition: Exception.h:263
std::string m_message
The message reported by what()
Definition: Exception.h:267
MisMatch< T > & operator=(const MisMatch< T > &rhs)=delete
const T Bval
container size
Definition: Exception.h:266
Exception for when an item is not found in a collection.
Definition: Exception.h:145
NotFoundError & operator=(const NotFoundError &A)
Assignment operator.
std::string outMessage
The message returned by what()
Definition: Exception.h:150
const std::string objectName
The name of the search object.
Definition: Exception.h:148
Marks code as not implemented yet.
Definition: Exception.h:138
Exception thrown when an attempt is made to dereference a null pointer.
Definition: Exception.h:305
const std::string outMessage
The message returned by what()
Definition: Exception.h:308
OpenGLError & operator=(const OpenGLError &A)
Assignment operator.
std::string outMessage
The message returned by what()
Definition: Exception.h:245
const std::string objectName
The name of the search object.
Definition: Exception.h:243
Records the filename, the description of failure and the line on which it happened.
Definition: Exception.h:115
const int m_lineNumber
Number of the line where the error occured.
Definition: Exception.h:118
ParseError & operator=(const ParseError &A)
Assignment operator.
std::string m_outMessage
The message returned by what()
Definition: Exception.h:120
Helper class which provides the Collimation Length for SANS instruments.
STL namespace.