OpenMS
Loading...
Searching...
No Matches
Exception.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Timo Sachsenberg$
6// $Authors: Marc Sturm $
7// --------------------------------------------------------------------------
8
9#pragma once
10
12#include <OpenMS/OpenMSConfig.h>
13#include <iosfwd>
14#include <stdexcept>
15#include <string>
16
17namespace OpenMS
18{
19
34 namespace Exception
35 {
36
62 class OPENMS_DLLAPI BaseException : public std::runtime_error
63 {
64 public:
68
70 BaseException() noexcept;
71
73 BaseException(const char* file, int line, const char* function) noexcept;
74
76 BaseException(const char* file, int line, const char* function, const std::string& name, const std::string& message) noexcept;
77
79 BaseException(const BaseException& exception) noexcept;
80
82 ~BaseException() noexcept override;
84
88
90 const char* getName() const noexcept;
91
93 int getLine() const noexcept;
94
96 const char* getFile() const noexcept;
97
99 const char* getFunction() const noexcept;
100
102 const char* getMessage() const noexcept;
103
105
106 protected:
108 const char* file_;
109
111 int line_;
112
114 const char* function_;
115
117 std::string name_;
118 };
119
127 class OPENMS_DLLAPI Precondition : public BaseException
128 {
129 public:
130 Precondition(const char* file, int line, const char* function, const std::string& condition) noexcept;
131 };
132
140 class OPENMS_DLLAPI Postcondition : public BaseException
141 {
142 public:
143 Postcondition(const char* file, int line, const char* function, const std::string& condition) noexcept;
144 };
145
154 class OPENMS_DLLAPI MissingInformation : public BaseException
155 {
156 public:
157 MissingInformation(const char* file, int line, const char* function, const std::string& error_message) noexcept;
158 };
159
160
174 class OPENMS_DLLAPI IndexUnderflow : public BaseException
175 {
176 public:
177 IndexUnderflow(const char* file, int line, const char* function, SignedSize index = 0, Size size = 0) noexcept;
178 };
179
192 class OPENMS_DLLAPI SizeUnderflow : public BaseException
193 {
194 public:
195 SizeUnderflow(const char* file, int line, const char* function, Size size = 0) noexcept;
196 };
197
210 class OPENMS_DLLAPI IndexOverflow : public BaseException
211 {
212 public:
213 IndexOverflow(const char* file, int line, const char* function, SignedSize index = 0, Size size = 0) noexcept;
214 };
215
216
227 class OPENMS_DLLAPI NotSorted : public BaseException
228 {
229 public:
230 NotSorted(const char* file, int line, const char* function, const std::string& message) noexcept;
231 };
232
243 class OPENMS_DLLAPI FailedAPICall : public BaseException
244 {
245 public:
246 FailedAPICall(const char* file, int line, const char* function, const std::string& message) noexcept;
247 };
248
256 class OPENMS_DLLAPI InvalidRange : public BaseException
257 {
258 public:
259 InvalidRange(const char* file, int line, const char* function) noexcept;
260 InvalidRange(const char* file, int line, const char* function, const std::string& message) noexcept;
261 };
262
263
275 class OPENMS_DLLAPI InvalidSize : public BaseException
276 {
277 public:
278 InvalidSize(const char* file, int line, const char* function, Size size, const std::string& message) noexcept;
279 };
280
281
290 class OPENMS_DLLAPI OutOfRange : public BaseException
291 {
292 public:
293 OutOfRange(const char* file, int line, const char* function) noexcept;
294 };
295
305 class OPENMS_DLLAPI InvalidValue : public BaseException
306 {
307 public:
308 InvalidValue(const char* file, int line, const char* function, const std::string& message, const std::string& value) noexcept;
309 };
310
316 class OPENMS_DLLAPI InvalidParameter : public BaseException
317 {
318 public:
319 InvalidParameter(const char* file, int line, const char* function, const std::string& message) noexcept;
320 };
321
330 class OPENMS_DLLAPI ConversionError : public BaseException
331 {
332 public:
333 ConversionError(const char* file, int line, const char* function, const std::string& error) noexcept;
334 };
335
345 class OPENMS_DLLAPI IllegalSelfOperation : public BaseException
346 {
347 public:
348 IllegalSelfOperation(const char* file, int line, const char* function) noexcept;
349 };
350
359 class OPENMS_DLLAPI NullPointer : public BaseException
360 {
361 public:
362 NullPointer(const char* file, int line, const char* function) noexcept;
363 };
364
372 class OPENMS_DLLAPI InvalidIterator : public BaseException
373 {
374 public:
375 InvalidIterator(const char* file, int line, const char* function) noexcept;
376 };
377
386 class OPENMS_DLLAPI IncompatibleIterators : public BaseException
387 {
388 public:
389 IncompatibleIterators(const char* file, int line, const char* function) noexcept;
390 };
391
399 class OPENMS_DLLAPI NotImplemented : public BaseException
400 {
401 public:
402 NotImplemented(const char* file, int line, const char* function) noexcept;
403 };
404
412 class OPENMS_DLLAPI IllegalTreeOperation : public BaseException
413 {
414 public:
415 IllegalTreeOperation(const char* file, int line, const char* function) noexcept;
416 };
417
428 class OPENMS_DLLAPI OutOfMemory : public BaseException, public std::bad_alloc
429 {
430 public:
431 OutOfMemory(const char* file, int line, const char* function, Size size = 0) noexcept;
432 };
433
439 class OPENMS_DLLAPI BufferOverflow : public BaseException
440 {
441 public:
442 BufferOverflow(const char* file, int line, const char* function) noexcept;
443 };
444
450 class OPENMS_DLLAPI DivisionByZero : public BaseException
451 {
452 public:
453 DivisionByZero(const char* file, int line, const char* function) noexcept;
454 };
455
461 class OPENMS_DLLAPI OutOfGrid : public BaseException
462 {
463 public:
464 OutOfGrid(const char* file, int line, const char* function) noexcept;
465 };
466
474 class OPENMS_DLLAPI FileNotFound : public BaseException
475 {
476 public:
477 FileNotFound(const char* file, int line, const char* function, const std::string& filename) noexcept;
478 };
479
487 class OPENMS_DLLAPI ExternalExecutableNotFound : public BaseException
488 {
489 public:
490 ExternalExecutableNotFound(const char* file, int line, const char* function, const std::string& filename) noexcept;
491 };
492
500 class OPENMS_DLLAPI FileNotReadable : public BaseException
501 {
502 public:
503 FileNotReadable(const char* file, int line, const char* function, const std::string& filename) noexcept;
504 };
505
513 class OPENMS_DLLAPI FileNotWritable : public BaseException
514 {
515 public:
516 FileNotWritable(const char* file, int line, const char* function, const std::string& filename) noexcept;
517 };
518
527 class OPENMS_DLLAPI FileNameTooLong : public BaseException
528 {
529 public:
530 FileNameTooLong(const char* file, int line, const char* function, const std::string& filename, int max_length) noexcept;
531 };
532
540 class OPENMS_DLLAPI IOException : public BaseException
541 {
542 public:
543 IOException(const char* file, int line, const char* function, const std::string& filename) noexcept;
544 };
545
553 class OPENMS_DLLAPI SqlOperationFailed : public BaseException
554 {
555 public:
556 SqlOperationFailed(const char* file, int line, const char* function, const std::string& description) noexcept;
557 };
558
566 class OPENMS_DLLAPI FileEmpty : public BaseException
567 {
568 public:
569 FileEmpty(const char* file, int line, const char* function, const std::string& filename) noexcept;
570 };
571
579 class OPENMS_DLLAPI IllegalPosition : public BaseException
580 {
581 public:
582 IllegalPosition(const char* file, int line, const char* function, float x, float y, float z) noexcept;
583 };
584
592 class OPENMS_DLLAPI ParseError : public BaseException
593 {
594 public:
595 ParseError(const char* file, int line, const char* function, const std::string& expression, const std::string& message) noexcept;
596 };
597
605 class OPENMS_DLLAPI UnableToCreateFile : public BaseException
606 {
607 public:
608 UnableToCreateFile(const char* file, int line, const char* function, const std::string& filename, const std::string& message = "") noexcept;
609 };
610
618 class OPENMS_DLLAPI InvalidFileType : public BaseException
619 {
620 public:
621 InvalidFileType(const char* file, int line, const char* function, const std::string& filename, const std::string& message = "") noexcept;
622 };
623
629 class OPENMS_DLLAPI IllegalArgument : public BaseException
630 {
631 public:
632 IllegalArgument(const char* file, int line, const char* function, const std::string& error_message) noexcept;
633 };
634
640 class OPENMS_DLLAPI InternalToolError : public BaseException
641 {
642 public:
643 InternalToolError(const char* file, int line, const char* function, const std::string& error_message) noexcept;
644 };
645
653 class OPENMS_DLLAPI ElementNotFound : public BaseException
654 {
655 public:
656 ElementNotFound(const char* file, int line, const char* function, const std::string& element) noexcept;
657 };
658
666 class OPENMS_DLLAPI UnableToFit : public BaseException
667 {
668 public:
669 UnableToFit(const char* file, int line, const char* function, const std::string& name, const std::string& message) noexcept;
670 };
671
680 class OPENMS_DLLAPI UnableToCalibrate : public BaseException
681 {
682 public:
683 UnableToCalibrate(const char* file, int line, const char* function, const std::string& name, const std::string& message) noexcept;
684 };
685
693 class OPENMS_DLLAPI DepletedIDPool : public BaseException
694 {
695 public:
696 DepletedIDPool(const char* file, int line, const char* function, const std::string& name, const std::string& message) noexcept;
697 };
698
699 } // namespace Exception
700
722 OPENMS_DLLAPI std::ostream& operator<<(std::ostream& os, const Exception::BaseException& e);
723
724} // namespace OpenMS
subpage TOPP_TargetedFileConverter Converts targeted feature or consensus feature files subpage TOPP_FileInfo Shows basic information about the file
Definition TOPP.doxygen:44
Exception base class.
Definition Exception.h:63
BaseException() noexcept
Default constructor.
Buffer overflow exception.
Definition Exception.h:440
BufferOverflow(const char *file, int line, const char *function) noexcept
Invalid conversion exception.
Definition Exception.h:331
ConversionError(const char *file, int line, const char *function, const std::string &error) noexcept
Exception used if no more unique document ID's can be drawn from ID pool.
Definition Exception.h:694
DepletedIDPool(const char *file, int line, const char *function, const std::string &name, const std::string &message) noexcept
Division by zero error exception.
Definition Exception.h:451
DivisionByZero(const char *file, int line, const char *function) noexcept
Element could not be found exception.
Definition Exception.h:654
ElementNotFound(const char *file, int line, const char *function, const std::string &element) noexcept
External executable (e.g. comet.exe) not found exception.
Definition Exception.h:488
ExternalExecutableNotFound(const char *file, int line, const char *function, const std::string &filename) noexcept
A call to an external library (other than OpenMS) went wrong.
Definition Exception.h:244
FailedAPICall(const char *file, int line, const char *function, const std::string &message) noexcept
File is empty.
Definition Exception.h:567
FileEmpty(const char *file, int line, const char *function, const std::string &filename) noexcept
Filename is too long to be writable/readable by the filesystem.
Definition Exception.h:528
FileNameTooLong(const char *file, int line, const char *function, const std::string &filename, int max_length) noexcept
File not found exception.
Definition Exception.h:475
FileNotFound(const char *file, int line, const char *function, const std::string &filename) noexcept
File not readable exception.
Definition Exception.h:501
FileNotReadable(const char *file, int line, const char *function, const std::string &filename) noexcept
File not writable exception.
Definition Exception.h:514
FileNotWritable(const char *file, int line, const char *function, const std::string &filename) noexcept
General IOException.
Definition Exception.h:541
IOException(const char *file, int line, const char *function, const std::string &filename) noexcept
A method or algorithm argument contains illegal values.
Definition Exception.h:630
IllegalArgument(const char *file, int line, const char *function, const std::string &error_message) noexcept
Invalid 3-dimensional position exception.
Definition Exception.h:580
IllegalPosition(const char *file, int line, const char *function, float x, float y, float z) noexcept
Illegal self operation exception.
Definition Exception.h:346
IllegalSelfOperation(const char *file, int line, const char *function) noexcept
Illegal tree operation exception.
Definition Exception.h:413
IllegalTreeOperation(const char *file, int line, const char *function) noexcept
Incompatible iterator exception.
Definition Exception.h:387
IncompatibleIterators(const char *file, int line, const char *function) noexcept
Int overflow exception.
Definition Exception.h:211
IndexOverflow(const char *file, int line, const char *function, SignedSize index=0, Size size=0) noexcept
Int underflow exception.
Definition Exception.h:175
IndexUnderflow(const char *file, int line, const char *function, SignedSize index=0, Size size=0) noexcept
A tool or algorithm which was called internally raised an exception.
Definition Exception.h:641
InternalToolError(const char *file, int line, const char *function, const std::string &error_message) noexcept
Invalid file type exception.
Definition Exception.h:619
InvalidFileType(const char *file, int line, const char *function, const std::string &filename, const std::string &message="") noexcept
Invalid iterator exception.
Definition Exception.h:373
InvalidIterator(const char *file, int line, const char *function) noexcept
Exception indicating that an invalid parameter was handed over to an algorithm.
Definition Exception.h:317
InvalidParameter(const char *file, int line, const char *function, const std::string &message) noexcept
Invalid range exception.
Definition Exception.h:257
InvalidRange(const char *file, int line, const char *function, const std::string &message) noexcept
InvalidRange(const char *file, int line, const char *function) noexcept
Invalid UInt exception.
Definition Exception.h:276
InvalidSize(const char *file, int line, const char *function, Size size, const std::string &message) noexcept
Invalid value exception.
Definition Exception.h:306
InvalidValue(const char *file, int line, const char *function, const std::string &message, const std::string &value) noexcept
Not all required information provided.
Definition Exception.h:155
MissingInformation(const char *file, int line, const char *function, const std::string &error_message) noexcept
Not implemented exception.
Definition Exception.h:400
NotImplemented(const char *file, int line, const char *function) noexcept
Array not sorted exception.
Definition Exception.h:228
NotSorted(const char *file, int line, const char *function, const std::string &message) noexcept
Null pointer argument is invalid exception.
Definition Exception.h:360
NullPointer(const char *file, int line, const char *function) noexcept
Out of grid exception.
Definition Exception.h:462
OutOfGrid(const char *file, int line, const char *function) noexcept
Out of memory exception.
Definition Exception.h:429
OutOfMemory(const char *file, int line, const char *function, Size size=0) noexcept
Out of range exception.
Definition Exception.h:291
OutOfRange(const char *file, int line, const char *function) noexcept
Parse Error exception.
Definition Exception.h:593
ParseError(const char *file, int line, const char *function, const std::string &expression, const std::string &message) noexcept
Postcondition failed exception.
Definition Exception.h:141
Postcondition(const char *file, int line, const char *function, const std::string &condition) noexcept
Precondition failed exception.
Definition Exception.h:128
Precondition(const char *file, int line, const char *function, const std::string &condition) noexcept
UInt underflow exception.
Definition Exception.h:193
SizeUnderflow(const char *file, int line, const char *function, Size size=0) noexcept
SqlOperation failed exception.
Definition Exception.h:554
SqlOperationFailed(const char *file, int line, const char *function, const std::string &description) noexcept
Exception used if an error occurred while calibrating a dataset.
Definition Exception.h:681
UnableToCalibrate(const char *file, int line, const char *function, const std::string &name, const std::string &message) noexcept
Unable to create file exception.
Definition Exception.h:606
UnableToCreateFile(const char *file, int line, const char *function, const std::string &filename, const std::string &message="") noexcept
Exception used if an error occurred while fitting a model to a given dataset.
Definition Exception.h:667
UnableToFit(const char *file, int line, const char *function, const std::string &name, const std::string &message) noexcept
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition Types.h:104
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
STL namespace.