[Tutor] How to return a list in an exception object?

David Aldrich David.Aldrich at EMEA.NEC.COM
Wed Jun 17 14:49:38 CEST 2015


Hi

I have a function that compares a set of files with a reference set of files.  All files are compared and then, if any differences were found, an exception is raised:

class Error(Exception): pass

def check_results(file_list):

    <snip>

    if isDifferent:
        raise Error('One or more result files differ from the reference result files')

I would like to pass back to the caller a list of the files that failed. How would I include that list in the exception object?

Best regards

David



More information about the Tutor mailing list