artemp/trac2github — Issue #443: config_error throws a Python UserWarning as an exception
Author: artemp
Created: 2011-10-09 20:34:32+00:00
State: open
Labels: Boost_Python_Binding

If a `config_error` is thrown in the C++ code, it gets turned into a Python exception via `PyErr_SetString()` [source:trunk/bindings/python/mapnik_python.cpp#L218]. But the class that is specified is `PyExc_UserWarning`, which means that in the python code it's raised as an error but is of a warning type. Confusing much?

Since `config_error` isn't actually a warning (ie. there are no alternative code paths), it should be changed into RuntimeError/ValueError/MapnikConfigError or something else that doesn't imply to the user that everything is okay.