Index: trunk/ippScripts/scripts/detrend_stack.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_stack.pl	(revision 22430)
+++ trunk/ippScripts/scripts/detrend_stack.pl	(revision 23186)
@@ -18,6 +18,4 @@
 use PS::IPP::Metadata::List qw( parse_md_list );
 use PS::IPP::Config 1.01 qw( :standard );
-
-my $ipprc = PS::IPP::Config->new(); # IPP configuration
 
 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
@@ -63,16 +61,10 @@
     defined $outroot;
 
-$ipprc->define_camera($camera);
 $det_type = uc($det_type);
 
+my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
 my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id)
     or &my_die("Missing entry in file rules", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
-
-# Unhandled exceptions should be passed on to my_die so they get pushed into the database
-$SIG{__DIE__} = sub { die @_ if $^S;
-                      my_die( $_[0], $det_id, $iter, $class_id, $PS_EXIT_UNKNOWN_ERROR ); };
-
-# optionally redirect the outputs from this script to LOG.IMFILE
-$ipprc->redirect_output($logDest) if $redirect;
+$ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR ) if $redirect;
 
 # Recipes to use as a function of detrend type
