also translate std::out_of_bounds => IndexError otherwise new std::exception => runtime catch will override - refs #1816
This commit is contained in:
parent
ab3525cfc4
commit
3e70226a69
1 changed files with 7 additions and 2 deletions
|
@ -295,6 +295,11 @@ void runtime_error_translator(std::runtime_error const & ex)
|
||||||
PyErr_SetString(PyExc_RuntimeError, ex.what());
|
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)
|
void standard_error_translator(std::exception const & ex)
|
||||||
{
|
{
|
||||||
PyErr_SetString(PyExc_RuntimeError, ex.what());
|
PyErr_SetString(PyExc_RuntimeError, ex.what());
|
||||||
|
@ -369,11 +374,11 @@ BOOST_PYTHON_MODULE(_mapnik)
|
||||||
using mapnik::save_map_to_string;
|
using mapnik::save_map_to_string;
|
||||||
using mapnik::render_grid;
|
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::config_error>(&config_error_translator);
|
||||||
register_exception_translator<mapnik::value_error>(&value_error_translator);
|
register_exception_translator<mapnik::value_error>(&value_error_translator);
|
||||||
register_exception_translator<std::runtime_error>(&runtime_error_translator);
|
register_exception_translator<std::runtime_error>(&runtime_error_translator);
|
||||||
// catch the rest
|
|
||||||
register_exception_translator<std::exception>(&standard_error_translator);
|
|
||||||
register_cairo();
|
register_cairo();
|
||||||
export_query();
|
export_query();
|
||||||
export_geometry();
|
export_geometry();
|
||||||
|
|
Loading…
Add table
Reference in a new issue