OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
ExceptionTranslation.h
Go to the documentation of this file.
1#ifndef PYOPAL_PYCORE_EXCEPTIONTRANSLATION_H
2#define PYOPAL_PYCORE_EXCEPTIONTRANSLATION_H 1
3
4#include <Python.h>
5#include <structmember.h>
6
7#include <string>
8#include <exception>
9
10#include <boost/python.hpp>
11
12namespace PyOpal {
13namespace py = boost::python;
14
16namespace ExceptionTranslation {
17
20
22template <class T>
23void translateException(T const& exception) {
24 PyErr_SetString(PyExc_RuntimeError, exception.what());
25}
26
28template <class T>
29void translateOpalException(T const& exception) {
30 std::string msg = exception.what()+" in C++ method "+exception.where();
31 PyErr_SetString(PyExc_RuntimeError, msg.c_str());
32}
33
34
35}
36}
37
38#endif
void translateOpalException(T const &exception)
void translateException(T const &exception)