...
You can find instructions about handling exit codes on our
Error Exit Code Handling Pages page.
Here is another example:
Code Block |
---|
function spooler_task_after() {
var rc = spooler_task.exit_code;
var next_state = spooler_task.order().job_chain_node().next_state();
spooler_log.info( "INFO: Job has ended with exit code " + rc );
switch( rc ) {
case 0 :
break;
case 1 :
spooler_log.error("suspend order");
spooler_task.order.suspend = true().set_suspended( true );
break;
case 5 :
// hier muss am Job ein Setback konfiguriert sein.
spooler_log.error("setback order");
spooler_task.order.setback();
break;
case 10 :
spooler_log.warn("INFO: Please check results and content, REPORT MAY BE AFFECTED");
spooler_log.info("order state changed to " + next_state);
spooler_task.order.state = next_state;
break;
case 15 :
spooler_log.warn("INFO: Please check results and content. THERE ARE REJECTS");
spooler_log.info("order state changed to " + next_state);
spooler_task.order.set_state( = next_state );
break;
default :
spooler_log.info("order state changed to " + next_state);
spooler_task.order.set_state =( next_state );
break;
}
} |
A possible solution in PerlScript could be:
Code Block |
---|
if ($spooler_task->params->var("max_exit_success")>0) {
my $max_exit = $spooler_task->params->var("max_exit_success");
$spooler_log->info( " Max exit success : $max_exit" );
if ($spooler_task->exit_code == 0) {
$spooler_log->info( "--> SUCCESS ");
}
elsif ($spooler_task->exit_code > $max_exit) {
$spooler_log->info( "--> ERROR ");
$spooler_log->info( "Error state : ".$chain_node->error_state );
}
else {
$spooler_log->warn( "--> WARNING ");
$spooler_log->info( "Next state : ".$chain_node->next_state );
$order->LetProperty( 'state', $chain_node->next_state );
}
$order->LetProperty( 'state_text', '=== Exit code '.$spooler_task->exit_code.' ===' );
} |