Skip Menu |

This queue is for tickets about the Brick CPAN distribution.

Report information
The Basics
Id: 27253
Status: new
Priority: 0/
Queue: Brick

People
Owner: Nobody in particular
Requestors: agianni [...] buffalo.edu
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Provide an easy means for extracting program_errors from result object
After I apply a profile but before I go forward with extracting errors, I want to check to see if I had any programming errors during my apply call. If so, I would like to put the brakes on the application and throw an exception. Ideally, I'd like to be able to call the flatten_by method on the result object to get the errors out: my $program_errors = $results->flatten_by('program_error'); It's a little funky because it's indexed by number, but I don't really care because it would work just fine. The problem is that this doesn't actually produce anything right now because of this: elsif( defined $eval_error ) # but not a reference { $eval_error = { handler => 'program_error', message => $eval_error, program_error => 1, errors => [], }; } Since the errors hash entry is present, the error is ignored by flatten_by (probably your intent). If I remove that hash entry, flatten_by works nicely for this purpose, but it also places the program error in the results of flatten_by_field. As I see it, there are a few options: 1. Write a new result method specifically for extracting program errors. 2. Remove the errors entry in the result hash entry for program errors and make flatten_by_field smart enough to ignore this errors, or put the owness on the developer to ignore these (probably not a good idea). 3. Provide additional arguments for flatten_by to allow display of composed errors (might be useful for other things anyway). For now, I'm doing number two in my local copy of the module because it's the easiest to get working, but it's probably the worst option in the long term.