gavo.user.errhandle module

Common error handling facilities for user interface components.


A fake cli operation just raising exceptions.

This is mainly for testing and development.


returns a string representation of aDict.

I’m trying to make this palatable for error message output.

gavo.user.errhandle.raiseAndCatch(opts=None, output=<function outputError>)[source]

Tries to come up with a good error message for the current exception.

opts can be an object with some attribute (read the source); this usually comes from user.cli’s main.

output must be a function accepting a single string, defaulting to something just encoding the string for the output found and dumping it to stderr.

The function returns a suggested return value for the whole program.


reflows a message to about 80 characters width.

Lines starting with whitespace will not be wrapped.