added that friendly error message to www_runCronJob
This commit is contained in:
parent
483bdd441f
commit
d975109e1f
1 changed files with 23 additions and 9 deletions
|
|
@ -277,16 +277,30 @@ sub www_runCronJob {
|
||||||
}
|
}
|
||||||
my $taskId = $session->form->param("taskId");
|
my $taskId = $session->form->param("taskId");
|
||||||
if ($taskId) {
|
if ($taskId) {
|
||||||
my $task = WebGUI::Workflow::Cron->new($session, $taskId);
|
# Try to instantiate the task
|
||||||
|
my $task = WebGUI::Workflow::Cron->new($session, $taskId);
|
||||||
return "done" unless (defined $task);
|
return "done" unless (defined $task);
|
||||||
WebGUI::Workflow::Instance->create($session, {
|
|
||||||
workflowId=>$task->get("workflowId"),
|
# Make a new workflow instance
|
||||||
className=>$task->get("className"),
|
my $instance =
|
||||||
methodName=>$task->get("methodName"),
|
WebGUI::Workflow::Instance->create($session, {
|
||||||
parameters=>$task->get("parameters"),
|
workflowId => $task->get("workflowId"),
|
||||||
priority=>$task->get("priority"),
|
className => $task->get("className"),
|
||||||
})->start(1);
|
methodName => $task->get("methodName"),
|
||||||
$task->delete(1) if ($task->get("runOnce"));
|
parameters => $task->get("parameters"),
|
||||||
|
priority => $task->get("priority"),
|
||||||
|
});
|
||||||
|
if ( !$instance ) {
|
||||||
|
$session->errorHandler->error(
|
||||||
|
"Could not create workflow instance for workflowId '" . $task->get( "workflowId" )
|
||||||
|
. "': The result was undefined"
|
||||||
|
);
|
||||||
|
return "done";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run the instance
|
||||||
|
$instance->start( 1 );
|
||||||
|
$task->delete( 1 ) if ( $task->get("runOnce") );
|
||||||
return "done";
|
return "done";
|
||||||
}
|
}
|
||||||
$session->errorHandler->warn("No task ID passed to cron job runner.");
|
$session->errorHandler->warn("No task ID passed to cron job runner.");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue