Package gavo :: Package user :: Module errhandle
[frames] | no frames]

Module errhandle

source code

Common error handling facilities for user interface components.

Functions
 
reformatMessage(msg)
reflows a message to about 80 characters width.
source code
 
outputError(message) source code
 
formatRow(aDict)
returns a string representation of aDict.
source code
 
raiseAndCatch(opts=None, output=<__builtin__.function object>)
raises the current exception and tries write a good error message for it.
source code
 
bailOut()
A fake cli operation just raising exceptions.
source code
Variables
  __package__ = 'gavo.user'
Function Details

reformatMessage(msg)

source code 

reflows a message to about 80 characters width.

Lines starting with whitespace will not be wrapped.

formatRow(aDict)

source code 

returns a string representation of aDict.

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

raiseAndCatch(opts=None, output=<__builtin__.function object>)

source code 

raises the current exception and tries write a good error message for it.

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.

bailOut()

source code 

A fake cli operation just raising exceptions.

This is mainly for testing and development.