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#include <iostream>
24
25namespace escript {
26
30class EsysException : public std::exception
31{
32public:
39 EsysException(const std::string& message) : msg(message)
40 {
41#if 1 // for debug on windows
42#ifdef _WIN32
43 std::cerr << std::endl << "EsysException:" << std::endl
44 << message << std::endl << std::endl
45 << std::flush;
46#endif
47#endif
48 }
49
51 virtual ~EsysException() throw() {}
52
57 inline virtual const char* what() const throw() { return msg.c_str(); }
58
59private:
60 //
61 // the exception message
62 std::string msg;
63};
64
70{
71public:
72 AssertException(const std::string& str) : EsysException(str) {}
73};
74
79class IOError : public EsysException
80{
81public:
82 IOError(const std::string& str) : EsysException(str) {}
83};
84
90{
91public:
92 NotImplementedError(const std::string& str) : EsysException(str) {}
93};
94
100{
101public:
102 ValueError(const std::string& str) : EsysException(str) {}
103};
104
105} // namespace escript
106
107#endif // __ESCRIPT_ESYSEXCEPTION_H__
108
An exception class for assertions within escript.
Definition: EsysException.h:70
AssertException(const std::string &str)
Definition: EsysException.h:72
The base class for escript exceptions.
Definition: EsysException.h:31
virtual ~EsysException()
Destructor.
Definition: EsysException.h:51
EsysException(const std::string &message)
Constructor which creates an Exception with the given message.
Definition: EsysException.h:39
std::string msg
Definition: EsysException.h:62
virtual const char * what() const
Returns a description of the exception.
Definition: EsysException.h:57
An exception class for Input/Output errors.
Definition: EsysException.h:80
IOError(const std::string &str)
Definition: EsysException.h:82
An exception class for features which are not (yet) implemented.
Definition: EsysException.h:90
NotImplementedError(const std::string &str)
Definition: EsysException.h:92
An exception class that signals an invalid argument value.
Definition: EsysException.h:100
ValueError(const std::string &str)
Definition: EsysException.h:102
Definition: AbstractContinuousDomain.cpp:23
Definition: blocktools.h:70