Warnings or other not-errors in the Stack

warnings.warn allows one to specify the type of warning, along with the message. I would propose that we create something like class LsstWarning(Warning) (or class LsstWarning(UserWarning), I’m not sure which is most appropriate), and then Tasks can subclass that for their own Warnings as necessary. Then PipelineTask can do something like this:

def handleWarning((message, category, filename, lineno, file=None, line=None):
    log.warn(warnings.formatwarning(message, category, filename, lineno, line=line)

if config.raiseOnWarning:
    warnings.simplefilter('error', LsstWarning)
else:
    warnings.simplefilter('always', LsstWarning)
    warnings.showwarning = handleWarning