Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Exception.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2017.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Timo Sachsenberg$
32 // $Authors: Marc Sturm $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_CONCEPT_EXCEPTION_H
36 #define OPENMS_CONCEPT_EXCEPTION_H
37 
38 #include <OpenMS/OpenMSConfig.h>
39 #include <OpenMS/CONCEPT/Types.h>
40 
41 #include <iosfwd>
42 #include <new>
43 #include <string>
44 
45 namespace OpenMS
46 {
47 
62  namespace Exception
63  {
64 
90  class OPENMS_DLLAPI BaseException :
91  public std::exception
92  {
93 public:
94 
98 
100  BaseException() noexcept;
101 
103  BaseException(const char* file, int line, const char* function) noexcept;
104 
106  BaseException(const char* file, int line, const char* function, const std::string& name, const std::string& message) noexcept;
107 
109  BaseException(const BaseException& exception) noexcept;
110 
112  virtual ~BaseException() noexcept;
114 
118 
120  const char* getName() const noexcept;
121 
123  virtual const char* what() const noexcept;
124 
126  int getLine() const noexcept;
127 
129  const char* getFile() const noexcept;
130 
132  const char* getFunction() const noexcept;
133 
135  const char* getMessage() const noexcept;
136 
138  void setMessage(const std::string& message) noexcept;
139 
141 
142 protected:
143 
145  const char* file_;
146 
148  int line_;
149 
151  const char* function_;
152 
154  std::string name_;
155 
157  std::string what_;
158  };
159 
167  class OPENMS_DLLAPI Precondition :
168  public BaseException
169  {
170 public:
171  Precondition(const char* file, int line, const char* function, const std::string& condition) noexcept;
172  };
173 
181  class OPENMS_DLLAPI Postcondition :
182  public BaseException
183  {
184 public:
185  Postcondition(const char* file, int line, const char* function, const std::string& condition) noexcept;
186  };
187 
196  class OPENMS_DLLAPI MissingInformation :
197  public BaseException
198  {
199 public:
200  MissingInformation(const char* file, int line, const char* function, const std::string& error_message) noexcept;
201  };
202 
203 
217  class OPENMS_DLLAPI IndexUnderflow :
218  public BaseException
219  {
220 public:
221  IndexUnderflow(const char* file, int line, const char* function, SignedSize index = 0, Size size = 0) noexcept;
222  };
223 
236  class OPENMS_DLLAPI SizeUnderflow :
237  public BaseException
238  {
239 public:
240  SizeUnderflow(const char* file, int line, const char* function, Size size = 0) noexcept;
241  };
242 
255  class OPENMS_DLLAPI IndexOverflow :
256  public BaseException
257  {
258 public:
259  IndexOverflow(const char* file, int line, const char* function, SignedSize index = 0, Size size = 0) noexcept;
260  };
261 
272  class OPENMS_DLLAPI FailedAPICall :
273  public BaseException
274  {
275 public:
276  FailedAPICall(const char* file, int line, const char* function, const std::string& message) noexcept;
277  };
278 
286  class OPENMS_DLLAPI InvalidRange :
287  public BaseException
288  {
289 public:
290  InvalidRange(const char* file, int line, const char* function) noexcept;
291  };
292 
293 
304  class OPENMS_DLLAPI InvalidSize :
305  public BaseException
306  {
307 public:
308  InvalidSize(const char* file, int line, const char* function, Size size = 0) noexcept;
309  };
310 
311 
320  class OPENMS_DLLAPI OutOfRange :
321  public BaseException
322  {
323 public:
324  OutOfRange(const char* file, int line, const char* function) noexcept;
325  };
326 
336  class OPENMS_DLLAPI InvalidValue :
337  public BaseException
338  {
339 public:
340  InvalidValue(const char* file, int line, const char* function, const std::string& message, const std::string& value) noexcept;
341  };
342 
348  class OPENMS_DLLAPI InvalidParameter :
349  public BaseException
350  {
351 public:
352  InvalidParameter(const char* file, int line, const char* function, const std::string& message) noexcept;
353  };
354 
363  class OPENMS_DLLAPI ConversionError :
364  public BaseException
365  {
366 public:
367  ConversionError(const char* file, int line, const char* function, const std::string& error) noexcept;
368  };
369 
379  class OPENMS_DLLAPI IllegalSelfOperation :
380  public BaseException
381  {
382 public:
383  IllegalSelfOperation(const char* file, int line, const char* function) noexcept;
384  };
385 
394  class OPENMS_DLLAPI NullPointer :
395  public BaseException
396  {
397 public:
398  NullPointer(const char* file, int line, const char* function) noexcept;
399  };
400 
408  class OPENMS_DLLAPI InvalidIterator :
409  public BaseException
410  {
411 public:
412  InvalidIterator(const char* file, int line, const char* function) noexcept;
413  };
414 
423  class OPENMS_DLLAPI IncompatibleIterators :
424  public BaseException
425  {
426 public:
427  IncompatibleIterators(const char* file, int line, const char* function) noexcept;
428  };
429 
437  class OPENMS_DLLAPI NotImplemented :
438  public BaseException
439  {
440 public:
441  NotImplemented(const char* file, int line, const char* function) noexcept;
442  };
443 
451  class OPENMS_DLLAPI IllegalTreeOperation :
452  public BaseException
453  {
454 public:
455  IllegalTreeOperation(const char* file, int line, const char* function) noexcept;
456  };
457 
468 #ifdef _MSC_VER // disable some seqan warnings that distract from ours
469 # pragma warning( push ) // save warning state
470 # pragma warning( disable : 4275 )
471 #endif
472  class OPENMS_DLLAPI OutOfMemory :
473  public BaseException, public std::bad_alloc
474  {
475 public:
476  OutOfMemory(const char* file, int line, const char* function, Size size = 0) noexcept;
477  };
478 #ifdef _MSC_VER
479 # pragma warning( pop ) // restore old warning state
480 #endif
481 
486  class OPENMS_DLLAPI BufferOverflow :
487  public BaseException
488  {
489 public:
490  BufferOverflow(const char* file, int line, const char* function) noexcept;
491  };
492 
498  class OPENMS_DLLAPI DivisionByZero :
499  public BaseException
500  {
501 public:
502  DivisionByZero(const char* file, int line, const char* function) noexcept;
503  };
504 
510  class OPENMS_DLLAPI OutOfGrid :
511  public BaseException
512  {
513 public:
514  OutOfGrid(const char* file, int line, const char* function) noexcept;
515  };
516 
524  class OPENMS_DLLAPI FileNotFound :
525  public BaseException
526  {
527 public:
528  FileNotFound(const char* file, int line, const char* function, const std::string& filename) noexcept;
529  };
530 
538  class OPENMS_DLLAPI FileNotReadable :
539  public BaseException
540  {
541 public:
542  FileNotReadable(const char* file, int line, const char* function, const std::string& filename) noexcept;
543  };
544 
552  class OPENMS_DLLAPI FileNotWritable :
553  public BaseException
554  {
555 public:
556  FileNotWritable(const char* file, int line, const char* function, const std::string& filename) noexcept;
557  };
558 
567  class OPENMS_DLLAPI FileNameTooLong :
568  public BaseException
569  {
570  public:
571  FileNameTooLong(const char* file, int line, const char* function, const std::string& filename, int max_length) noexcept;
572  };
573 
581  class OPENMS_DLLAPI IOException :
582  public BaseException
583  {
584 public:
585  IOException(const char* file, int line, const char* function, const std::string& filename) noexcept;
586  };
587 
595  class OPENMS_DLLAPI FileEmpty :
596  public BaseException
597  {
598 public:
599  FileEmpty(const char* file, int line, const char* function, const std::string& filename) noexcept;
600  };
601 
609  class OPENMS_DLLAPI IllegalPosition :
610  public BaseException
611  {
612 public:
613  IllegalPosition(const char* file, int line, const char* function, float x, float y, float z) noexcept;
614  };
615 
623  class OPENMS_DLLAPI ParseError :
624  public BaseException
625  {
626 public:
627  ParseError(const char* file, int line, const char* function, const std::string& expression, const std::string& message) noexcept;
628  };
629 
637  class OPENMS_DLLAPI UnableToCreateFile :
638  public BaseException
639  {
640 public:
641  UnableToCreateFile(const char* file, int line, const char* function, const std::string& filename, const std::string& message = "") noexcept;
642  };
643 
649  class OPENMS_DLLAPI IllegalArgument :
650  public BaseException
651  {
652 public:
653  IllegalArgument(const char* file, int line, const char* function, const std::string& error_message) noexcept;
654  };
655 
663  class OPENMS_DLLAPI ElementNotFound :
664  public BaseException
665  {
666 public:
667  ElementNotFound(const char* file, int line, const char* function, const std::string& element) noexcept;
668  };
669 
677  class OPENMS_DLLAPI UnableToFit :
678  public BaseException
679  {
680 public:
681  UnableToFit(const char* file, int line, const char* function, const std::string& name, const std::string& message) noexcept;
682  };
683 
692  class OPENMS_DLLAPI UnableToCalibrate :
693  public BaseException
694  {
695 public:
696  UnableToCalibrate(const char* file, int line, const char* function, const std::string& name, const std::string& message) noexcept;
697  };
698 
706  class OPENMS_DLLAPI DepletedIDPool :
707  public BaseException
708  {
709 public:
710  DepletedIDPool(const char* file, int line, const char* function, const std::string& name, const std::string& message) noexcept;
711  };
712 
713  } // namespace Exception
714 
736  OPENMS_DLLAPI std::ostream& operator<<(std::ostream& os, const Exception::BaseException& e);
737 
738 } // namespace OPENMS
739 
740 #endif // OPENMS_CONCEPT_EXCEPTION_H
const char * file_
The source file the exception was thrown in.
Definition: Exception.h:145
Int underflow exception.
Definition: Exception.h:217
File not writable exception.
Definition: Exception.h:552
Incompatible iterator exception.
Definition: Exception.h:423
Element could not be found exception.
Definition: Exception.h:663
Out of range exception.
Definition: Exception.h:320
Int overflow exception.
Definition: Exception.h:255
A call to an external library (other than OpenMS) went wrong.
Definition: Exception.h:272
Invalid 3-dimensional position exception.
Definition: Exception.h:609
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:135
File not found exception.
Definition: Exception.h:524
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
const char * function_
The source file the exception was thrown in.
Definition: Exception.h:151
Precondition failed exception.
Definition: Exception.h:167
int line_
The line number the exception was thrown in.
Definition: Exception.h:148
Exception used if an error occurred while calibrating a dataset.
Definition: Exception.h:692
File is empty.
Definition: Exception.h:595
File not readable exception.
Definition: Exception.h:538
A method or algorithm argument contains illegal values.
Definition: Exception.h:649
Null pointer argument is invalid exception.
Definition: Exception.h:394
int exception
(Used by various macros. Indicates a rough category of the exception being caught.)
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
Filename is too long to be writable/readable by the filesystem.
Definition: Exception.h:567
Invalid iterator exception.
Definition: Exception.h:408
Exception indicating that an invalid parameter was handed over to an algorithm.
Definition: Exception.h:348
Exception base class.
Definition: Exception.h:90
Invalid conversion exception.
Definition: Exception.h:363
Division by zero error exception.
Definition: Exception.h:498
Invalid UInt exception.
Definition: Exception.h:304
Out of memory exception.
Definition: Exception.h:472
Invalid value exception.
Definition: Exception.h:336
General IOException.
Definition: Exception.h:581
Illegal self operation exception.
Definition: Exception.h:379
Exception used if no more unique document ID&#39;s can be drawn from ID pool.
Definition: Exception.h:706
Invalid range exception.
Definition: Exception.h:286
Exception used if an error occurred while fitting a model to a given dataset.
Definition: Exception.h:677
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
UInt underflow exception.
Definition: Exception.h:236
Unable to create file exception.
Definition: Exception.h:637
Postcondition failed exception.
Definition: Exception.h:181
Out of grid exception.
Definition: Exception.h:510
std::string name_
The name of the exception.
Definition: Exception.h:154
Buffer overflow exception.
Definition: Exception.h:486
Not implemented exception.
Definition: Exception.h:437
std::string what_
A more detailed description of the exception&#39;s cause.
Definition: Exception.h:157
Not all required information provided.
Definition: Exception.h:196
Illegal tree operation exception.
Definition: Exception.h:451
Parse Error exception.
Definition: Exception.h:623

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:00 using doxygen 1.8.13