better error handling

This commit is contained in:
JT Smith 2007-07-06 19:00:31 +00:00
parent 0c9d1f4332
commit 1a3165e6ee
3 changed files with 19 additions and 16 deletions

View file

@ -79,10 +79,14 @@ The priority (1,2, or 3) that this instance should be run at.
sub addInstance {
my ($self, $instance) = @_[OBJECT, ARG0];
my $priority = ($instance->{priority} -1) * 10;
$instance->{lastState} = "never run";
$self->debug("Adding workflow instance ".$instance->{instanceId}." from ".$instance->{sitename}." to queue at priority ".$priority.".");
$self->getWaitingQueue->enqueue($priority, $instance);
if ($instance->{priority} < 1 || $instance->{instanceId} eq "" || $instance->{sitename} eq "") {
$self->error("Can't add workflow instance with missing data: ". $instance->{sitename}." - ".$instance->{instanceId});
} else {
my $priority = ($instance->{priority} -1) * 10;
$instance->{lastState} = "never run";
$self->debug("Adding workflow instance ".$instance->{instanceId}." from ".$instance->{sitename}." to queue at priority ".$priority.".");
$self->getWaitingQueue->enqueue($priority, $instance);
}
}
#-------------------------------------------------------------------