also translate std::out_of_bounds => IndexError otherwise new std::exception => runtime catch will override - refs #1816

This commit is contained in:
Dane Springmeyer 2013-04-17 15:28:48 -07:00
parent ab3525cfc4
commit 3e70226a69

View file

@ -295,6 +295,11 @@ void runtime_error_translator(std::runtime_error const & ex)
PyErr_SetString(PyExc_RuntimeError, ex.what());
}
void out_of_range_error_translator(std::out_of_range const & ex)
{
PyErr_SetString(PyExc_IndexError, ex.what());
}
void standard_error_translator(std::exception const & ex)
{
PyErr_SetString(PyExc_RuntimeError, ex.what());
@ -369,11 +374,11 @@ BOOST_PYTHON_MODULE(_mapnik)
using mapnik::save_map_to_string;
using mapnik::render_grid;
register_exception_translator<std::exception>(&standard_error_translator);
register_exception_translator<std::out_of_range>(&out_of_range_error_translator);
register_exception_translator<mapnik::config_error>(&config_error_translator);
register_exception_translator<mapnik::value_error>(&value_error_translator);
register_exception_translator<std::runtime_error>(&runtime_error_translator);
// catch the rest
register_exception_translator<std::exception>(&standard_error_translator);
register_cairo();
export_query();
export_geometry();