Closed netsensei closed 7 years ago
Okay, isolated the problem.
On line 69 in Condition.pm we see this code:
if ($self->options->{sprintf('fixer_%s', $fixer)}->{'condition'} eq $self->condition) {
$fix_file_name = $self->options->{sprintf('fixer_%s', $fixer)}->{'file_name'};
last;
}
Problem: $self->condition is never initialised. This causes $fix_file_name to stay empty which triggers the BadArg block in Fix.pm.
$self->condition
should be initialised by $self->_build_condition()
- I think this happens when $self->options->{sprintf('fixer_%s', $fixer)}->{'condition'}
never equals $self->condition
. Will investigate.
I think $self->condition is empty when the path can't be found in the XML or doesn't yield a value. That's why it borks.
This has been partially fixed in 43157ec, but:
Currently, transport.pm
does not allow us to distinguish between different kinds of error (e.g. the difference between Catmandu::BadArg
and Catmandu::BadVal
. So we are faced with the choice between die-ing on every error the Conditional fixer generates, or never.
Currently, the Conditional fixer generates two kinds of errors: errors in loading modules (missing arguments, missing modules etc.). This should be fatal (we can not recover from this). But, to fix #29, it now also generates a "Fixer not found for condition", which is recoverable (the following item could have a condition that matches one of the fixers).
I have elected never to die. Otherwise, if item x (about halfway the run) does not match any of the fixers, the run ends and you have to start over. We don't want that. Downside is that if we get a unrecoverable error, it will print errors for the entire run, one item at the time.
A solution for this could be the implementation of a Datahub::Factory::Error
-module that would be able to handle two different kinds of error, with different actions.
Okay, trying to work with conditions in the ini file, but I get an error.
Here's what I do in my pipeline config:
This isn't any different from what's in the transport.pm pod. But I do get this error + stack trace:
which is weird because file_name IS defined in the config file. I updated Catmandu to the latest stable version (1.0506) but that doesn't change the output. Still getting that error.
Needs investigating...