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 "system_dep.h"
22#include "DataTypes.h"
23#include "EsysException.h"
24
25// put this within all boost module definitions so exceptions are translated
26// properly
27#define REGISTER_ESCRIPT_EXCEPTION_TRANSLATORS \
28 register_exception_translator<escript::AssertException>(&escript::AssertionErrorTranslator);\
29 register_exception_translator<escript::IOError>(&escript::IOErrorTranslator);\
30 register_exception_translator<escript::NotImplementedError>(&escript::NotImplementedErrorTranslator);\
31 register_exception_translator<escript::ValueError>(&escript::ValueErrorTranslator)
32
33namespace escript {
34
40 void AssertionErrorTranslator(const EsysException& e);
41
47 void IOErrorTranslator(const EsysException& e);
48
54 void NotImplementedErrorTranslator(const EsysException& e);
55
61 void RuntimeErrorTranslator(const EsysException& e);
62
68 void ValueErrorTranslator(const EsysException& e);
69
70} // end of namespace
71
72#endif // __ESCRIPT_EXCEPTIONTRANSLATORS_H__
73
#define ESCRIPT_DLL_API
Definition escriptcore/src/system_dep.h:30
Definition AbstractContinuousDomain.cpp:23
void RuntimeErrorTranslator(const EsysException &e)
Function which translates an EsysException into a python RuntimeError.
Definition ExceptionTranslators.cpp:37
void ValueErrorTranslator(const EsysException &e)
Function which translates an EsysException into a python ValueError.
Definition ExceptionTranslators.cpp:42
void AssertionErrorTranslator(const EsysException &e)
Function which translates an EsysException into a python AssertionError.
Definition ExceptionTranslators.cpp:22
void IOErrorTranslator(const EsysException &e)
Function which translates an EsysException into a python IOError.
Definition ExceptionTranslators.cpp:27
void NotImplementedErrorTranslator(const EsysException &e)
Function which translates an EsysException into a python NotImplementedError.
Definition ExceptionTranslators.cpp:32