IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 24, 2009, 12:00:25 PM (17 years ago)
Author:
Paul Price
Message:

Adding handling for missed exceptions, similar to register_imfile.pl --- the idea is to have exceptions trigger the my_die functions so that errors are recorded in the database, and don't go on forever.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/detrend_norm_exp.pl

    r20120 r22430  
    2424use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
    2525use Pod::Usage qw( pod2usage );
     26
     27# Look for programs we need
     28my $missing_tools;
     29my $dettool = can_run('dettool') or (warn "Can't find dettool" and $missing_tools = 1);
     30my $ppImage = can_run('ppImage') or (warn "Can't find ppImage" and $missing_tools = 1);
     31my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1);
     32if ($missing_tools) {
     33    warn("Can't find required tools.");
     34    exit($PS_EXIT_CONFIG_ERROR);
     35}
    2636
    2737my ($det_id, $iter, $det_type, $camera, $outroot, $dbname, $reduction, $verbose, $no_update, $no_op, $redirect, $save_temps);
     
    5060    defined $outroot;
    5161
     62# Unhandled exceptions should be passed on to my_die so they get pushed into the database
     63$SIG{__DIE__} = sub { die @_ if $^S;
     64                      my_die( $_[0], $det_id, $iter, $PS_EXIT_UNKNOWN_ERROR ); };
     65
    5266my $logfile = $outroot . ".log";
    5367
     
    6074my $recipe = $ipprc->reduction($reduction, uc($det_type) . '_JPEG_IMAGE');
    6175&my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $PS_EXIT_PROG_ERROR) unless defined $recipe;
    62 
    63 # Look for programs we need
    64 my $missing_tools;
    65 my $dettool = can_run('dettool') or (warn "Can't find dettool" and $missing_tools = 1);
    66 my $ppImage = can_run('ppImage') or (warn "Can't find ppImage" and $missing_tools = 1);
    67 my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1);
    68 if ($missing_tools) {
    69     warn("Can't find required tools.");
    70     exit($PS_EXIT_CONFIG_ERROR);
    71 }
    7276
    7377# Get list of component files
Note: See TracChangeset for help on using the changeset viewer.