my $run_at = DateTime->now_local;
my $history;
- eval {
+ my $ok = eval {
my $result = $package->new->run($self);
$history = SL::DB::BackgroundJobHistory
1;
};
- if ($EVAL_ERROR) {
+ if (!$ok) {
$history = SL::DB::BackgroundJobHistory
->new(package_name => $self->package_name,
run_at => $run_at,
status => 'failure',
- error => $EVAL_ERROR,
+ error_col => $EVAL_ERROR,
data => $self->data);
$history->save;
}