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/fake_imfile.pl

    r21371 r22430  
    4141use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
    4242use Pod::Usage qw( pod2usage );
     43
     44# Look for programs we need
     45my $missing_tools;
     46my $faketool = can_run('faketool') or (warn "Can't find faketool" and $missing_tools = 1);
     47my $ppSim = can_run('ppSim') or (warn "Can't find ppSim" and $missing_tools = 1);
     48my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1);
     49if ($missing_tools) {
     50    warn("Can't find required tools.");
     51    exit($PS_EXIT_CONFIG_ERROR);
     52}
    4353
    4454# Parse the command-line arguments
     
    7282    defined $outroot;
    7383
     84# Unhandled exceptions should be passed on to my_die so they get pushed into the database
     85$SIG{__DIE__} = sub { die @_ if $^S;
     86                      my_die( $_[0], $exp_id, $fake_id, $class_id, $PS_EXIT_UNKNOWN_ERROR ); };
     87
    7488$ipprc->define_camera($camera);
    7589
     
    8397unless ($recipe) {
    8498    &my_die("Couldn't find selected reduction for FAKE: $reduction\n", $exp_id, $fake_id, $class_id, $PS_EXIT_CONFIG_ERROR);
    85 }
    86 
    87 # Look for programs we need
    88 my $missing_tools;
    89 my $faketool = can_run('faketool') or (warn "Can't find faketool" and $missing_tools = 1);
    90 my $ppSim = can_run('ppSim') or (warn "Can't find ppSim" and $missing_tools = 1);
    91 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1);
    92 if ($missing_tools) {
    93     warn("Can't find required tools.");
    94     exit($PS_EXIT_CONFIG_ERROR);
    9599}
    96100
Note: See TracChangeset for help on using the changeset viewer.