+ add std::runtime_error to python translator
This commit is contained in:
parent
66a6ec78c7
commit
abd40edfd9
1 changed files with 10 additions and 2 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue