die if cannot open output or exception files
[migration-tools.git] / fingerprinter
index dcf2e29..4318340 100755 (executable)
@@ -16,8 +16,8 @@ $| = 1;
 
 initialize($conf);
 
-open OF, '>', $conf->{output};
-open XF, '>', $conf->{exception};
+open OF, '>', $conf->{output} or die "$0: cannot open output file $conf->{output}: $!\n";
+open XF, '>', $conf->{exception} or die "$0: cannot open exception file $conf->{output}: $!\n";
 
 for my $file (@ARGV) {
     print XF "Processing $file\n";
@@ -32,7 +32,7 @@ for my $file (@ARGV) {
         eval { $record = $batch->next; };
         if ($@) {
             import MARC::File::XML;
-            print "bad record\n";
+            print "skipping bad record: $@\n";
             next;
         }
         last unless $record;