Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/python/test/exception_translator.cpp @ 29

Last change on this file since 29 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 640 bytes
Line 
1// Copyright David Abrahams 2004. Distributed under the Boost
2// Software License, Version 1.0. (See accompanying
3// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4#include <boost/python/module.hpp>
5#include <boost/python/def.hpp>
6#include <boost/python/exception_translator.hpp>
7
8struct error {};
9
10void translate(error const& /*e*/)
11{
12    PyErr_SetString(PyExc_RuntimeError, "!!!error!!!");
13}
14
15void throw_error()
16{
17    throw error();
18   
19}
20
21BOOST_PYTHON_MODULE(exception_translator_ext)
22{
23  using namespace boost::python;
24  register_exception_translator<error>(&translate);
25 
26  def("throw_error", throw_error);
27}
28
Note: See TracBrowser for help on using the repository browser.