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

    r20673 r22430  
    2828use Pod::Usage qw( pod2usage );
    2929
     30# Look for programs we need
     31my $missing_tools;
     32my $magictool = can_run('magictool') or (warn "Can't find magictool" and $missing_tools = 1);
     33my $streaksremove = can_run('streaksremove') or (warn "Can't find streaksremove" and $missing_tools = 1);
     34if ($missing_tools) {
     35    warn("Can't find required tools.");
     36    exit($PS_EXIT_CONFIG_ERROR);
     37}
     38
    3039# Parse the command-line arguments
    3140my ($magic_id, $camera, $dbname, $outroot, $save_temps, $verbose, $no_update, $no_op, $logfile);
     
    4958    defined $outroot;
    5059
     60# Unhandled exceptions should be passed on to my_die so they get pushed into the database
     61$SIG{__DIE__} = sub { die @_ if $^S;
     62                      my_die( $_[0], $magic_id, $PS_EXIT_UNKNOWN_ERROR ); };
     63
    5164$ipprc->define_camera($camera);
    5265
    5366$ipprc->redirect_output($logfile) if $logfile;
    54 
    55 # Look for programs we need
    56 my $missing_tools;
    57 my $magictool = can_run('magictool') or (warn "Can't find magictool" and $missing_tools = 1);
    58 my $streaksremove = can_run('streaksremove') or (warn "Can't find streaksremove" and $missing_tools = 1);
    59 if ($missing_tools) {
    60     warn("Can't find required tools.");
    61     exit($PS_EXIT_CONFIG_ERROR);
    62 }
    6367
    6468my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
     
    8589### Do the heavy lifting
    8690{
    87     my $command = "$streaks --streaks"; # Command to execute
     91    my $command = "$streaksremove --streaks"; # Command to execute
    8892    my @basenames;              # List of base names
    8993
Note: See TracChangeset for help on using the changeset viewer.