escript  Revision_
ExceptionTranslators.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_EXCEPTIONTRANSLATORS_H__
19 #define __ESCRIPT_EXCEPTIONTRANSLATORS_H__
20 
21 #include "DataTypes.h"
22 #include "EsysException.h"
23 
24 // put this within all boost module definitions so exceptions are translated
25 // properly
26 #define REGISTER_ESCRIPT_EXCEPTION_TRANSLATORS \
27  register_exception_translator<escript::AssertException>(&escript::AssertionErrorTranslator);\
28  register_exception_translator<escript::IOError>(&escript::IOErrorTranslator);\
29  register_exception_translator<escript::NotImplementedError>(&escript::NotImplementedErrorTranslator);\
30  register_exception_translator<escript::ValueError>(&escript::ValueErrorTranslator)
31 
32 namespace escript {
33 
38  void AssertionErrorTranslator(const EsysException& e);
39 
44  void IOErrorTranslator(const EsysException& e);
45 
50  void NotImplementedErrorTranslator(const EsysException& e);
51 
56  void RuntimeErrorTranslator(const EsysException& e);
57 
62  void ValueErrorTranslator(const EsysException& e);
63 
64 } // end of namespace
65 
66 #endif // __ESCRIPT_EXCEPTIONTRANSLATORS_H__
67 
escript::EsysException
The base class for escript exceptions.
Definition: EsysException.h:30
escript::AssertionErrorTranslator
void AssertionErrorTranslator(const EsysException &e)
Function which translates an EsysException into a python AssertionError.
Definition: ExceptionTranslators.cpp:22
escript::IOErrorTranslator
void IOErrorTranslator(const EsysException &e)
Function which translates an EsysException into a python IOError.
Definition: ExceptionTranslators.cpp:27
escript::RuntimeErrorTranslator
void RuntimeErrorTranslator(const EsysException &e)
Function which translates an EsysException into a python RuntimeError.
Definition: ExceptionTranslators.cpp:37
EsysException.h
escript
Definition: AbstractContinuousDomain.cpp:23
escript::ValueErrorTranslator
void ValueErrorTranslator(const EsysException &e)
Function which translates an EsysException into a python ValueError.
Definition: ExceptionTranslators.cpp:42
DataTypes.h
escript::EsysException::what
virtual const char * what() const
Returns a description of the exception.
Definition: EsysException.h:47
escript::NotImplementedErrorTranslator
void NotImplementedErrorTranslator(const EsysException &e)
Function which translates an EsysException into a python NotImplementedError.
Definition: ExceptionTranslators.cpp:32
ExceptionTranslators.h