gavo.user.errhandle module

Common error handling facilities for user interface components.

gavo.user.errhandle.bailOut()[source]

A fake cli operation just raising exceptions.

This is mainly for testing and development.

gavo.user.errhandle.formatRow(aDict)[source]

returns a string representation of aDict.

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

gavo.user.errhandle.outputError(message)[source]
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.

gavo.user.errhandle.reformatMessage(msg)[source]

reflows a message to about 80 characters width.

Lines starting with whitespace will not be wrapped.