+ add std::runtime_error to python translator

This commit is contained in:
artemp 2012-08-08 12:11:30 +01:00
parent 66a6ec78c7
commit abd40edfd9

View file

@ -280,14 +280,21 @@ double scale_denominator(mapnik::Map const &map, bool geographic)
}
// http://docs.python.org/c-api/exceptions.html#standard-exceptions
void config_error_translator(mapnik::config_error const & ex) {
void config_error_translator(mapnik::config_error const & ex)
{
PyErr_SetString(PyExc_RuntimeError, ex.what());
}
void value_error_translator(mapnik::value_error const & ex) {
void value_error_translator(mapnik::value_error const & ex)
{
PyErr_SetString(PyExc_ValueError, ex.what());
}
void runtime_error_translator(std::runtime_error const & ex)
{
PyErr_SetString(PyExc_RuntimeError, ex.what());
}
unsigned mapnik_version()
{
return MAPNIK_VERSION;
@ -359,6 +366,7 @@ BOOST_PYTHON_MODULE(_mapnik)
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);
register_cairo();
export_query();
export_geometry();