escript  Revision_
EsysException.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2016 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 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16 
17 #ifndef __ESCRIPT_ESYSEXCEPTION_H__
18 #define __ESCRIPT_ESYSEXCEPTION_H__
19 
20 #include <exception>
21 #include <string>
22 
23 namespace escript {
24 
28 class EsysException : public std::exception
29 {
30 public:
37  EsysException(const std::string& message) : msg(message) {}
38 
40  virtual ~EsysException() throw() {}
41 
46  inline virtual const char* what() const throw() { return msg.c_str(); }
47 
48 private:
49  //
50  // the exception message
51  std::string msg;
52 };
53 
59 {
60 public:
61  AssertException(const std::string& str) : EsysException(str) {}
62 };
63 
68 class IOError : public EsysException
69 {
70 public:
71  IOError(const std::string& str) : EsysException(str) {}
72 };
73 
79 {
80 public:
81  NotImplementedError(const std::string& str) : EsysException(str) {}
82 };
83 
88 class ValueError : public EsysException
89 {
90 public:
91  ValueError(const std::string& str) : EsysException(str) {}
92 };
93 
94 } // namespace escript
95 
96 #endif // __ESCRIPT_ESYSEXCEPTION_H__
97 
EsysException(const std::string &message)
Constructor which creates an Exception with the given message.
Definition: EsysException.h:37
The base class for escript exceptions.
Definition: EsysException.h:28
Definition: blocktools.h:68
AssertException(const std::string &str)
Definition: EsysException.h:61
An exception class for assertions within escript.
Definition: EsysException.h:58
Definition: AbstractContinuousDomain.cpp:22
std::string msg
Definition: EsysException.h:51
An exception class for Input/Output errors.
Definition: EsysException.h:68
NotImplementedError(const std::string &str)
Definition: EsysException.h:81
An exception class for features which are not (yet) implemented.
Definition: EsysException.h:78
virtual const char * what() const
Returns a description of the exception.
Definition: EsysException.h:46
IOError(const std::string &str)
Definition: EsysException.h:71
virtual ~EsysException()
Destructor.
Definition: EsysException.h:40
An exception class that signals an invalid argument value.
Definition: EsysException.h:88
ValueError(const std::string &str)
Definition: EsysException.h:91