refactor error handler to work with mapnik/debug macros