escript  Revision_
EsysException.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2020 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Apache License, version 2.0
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014-2017 by Centre for Geoscience Computing (GeoComp)
14 * Development from 2019 by School of Earth and Environmental Sciences
15 **
16 *****************************************************************************/
17 
18 #ifndef __ESCRIPT_ESYSEXCEPTION_H__
19 #define __ESCRIPT_ESYSEXCEPTION_H__
20 
21 #include <exception>
22 #include <string>
23 
24 namespace escript {
25 
29 class EsysException : public std::exception
30 {
31 public:
38  EsysException(const std::string& message) : msg(message) {}
39 
41  virtual ~EsysException() throw() {}
42 
47  inline virtual const char* what() const throw() { return msg.c_str(); }
48 
49 private:
50  //
51  // the exception message
52  std::string msg;
53 };
54 
59 class AssertException : public EsysException
60 {
61 public:
62  AssertException(const std::string& str) : EsysException(str) {}
63 };
64 
69 class IOError : public EsysException
70 {
71 public:
72  IOError(const std::string& str) : EsysException(str) {}
73 };
74 
80 {
81 public:
82  NotImplementedError(const std::string& str) : EsysException(str) {}
83 };
84 
89 class ValueError : public EsysException
90 {
91 public:
92  ValueError(const std::string& str) : EsysException(str) {}
93 };
94 
95 } // namespace escript
96 
97 #endif // __ESCRIPT_ESYSEXCEPTION_H__
98 
escript::EsysException::msg
std::string msg
Definition: EsysException.h:77
message
Definition: blocktools.h:68
escript::EsysException
The base class for escript exceptions.
Definition: EsysException.h:41
escript::NotImplementedError
An exception class for features which are not (yet) implemented.
Definition: EsysException.h:91
escript::EsysException::~EsysException
virtual ~EsysException()
Destructor.
Definition: EsysException.h:66
escript::ValueError::ValueError
ValueError(const std::string &str)
Definition: EsysException.h:104
escript::IOError
An exception class for Input/Output errors.
Definition: EsysException.h:81
escript::NotImplementedError::NotImplementedError
NotImplementedError(const std::string &str)
Definition: EsysException.h:94
escript::EsysException::EsysException
EsysException(const std::string &message)
Constructor which creates an Exception with the given message.
Definition: EsysException.h:63
escript::IOError::IOError
IOError(const std::string &str)
Definition: EsysException.h:84
escript::AssertException::AssertException
AssertException(const std::string &str)
Definition: EsysException.h:74
escript
Definition: AbstractContinuousDomain.cpp:23
escript::EsysException::what
virtual const char * what() const
Returns a description of the exception.
Definition: EsysException.h:72
escript::ValueError
An exception class that signals an invalid argument value.
Definition: EsysException.h:101