1 |
On 02/26/2010 08:27 PM, Brian Harring wrote: |
2 |
> On Sat, Feb 27, 2010 at 05:02:18AM +0100, Sebastian Pipping wrote: |
3 |
>> On 02/27/10 04:20, Zac Medico wrote: |
4 |
>>> Do you have an example case where you want to use this? |
5 |
>> |
6 |
>> Multiple defects in metadata.xml are such a case. |
7 |
>> At some point all the exceptions will have to collected, e.g. two |
8 |
>> invalid herds are mentioned. In that case a single exception with a |
9 |
>> list of invalid herds may suffice but it gets worse when combining |
10 |
>> errors of slightly different types. |
11 |
> |
12 |
> I'd suggest looking at pchecks design instead of trying to do |
13 |
> composite exceptions- essentially pass in a reporter that is invoked |
14 |
> w/ the failure/'exception' instead passed in. |
15 |
> |
16 |
> Doing what you're suggesting (catching all exceptions at the top and |
17 |
> trying sum them essentially) results in screwy code flow in the |
18 |
> specific check- consider a check that can flag multiple issues. |
19 |
> Chucking an exception means you get the first warning spotted (and |
20 |
> just that). |
21 |
> |
22 |
> Do the reporter/observer/tweaked visitor approach, you get all of the |
23 |
> issues, and it's left to the reporter to decide what to output (and |
24 |
> how to format it). |
25 |
|
26 |
Good idea. It's similar to the os.walk() 'onerror' argument. |
27 |
-- |
28 |
Thanks, |
29 |
Zac |