protecting MARC::Batch->next with a try block
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 8 Oct 2008 16:54:12 +0000 (16:54 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 8 Oct 2008 16:54:12 +0000 (16:54 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10792 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm

index 233937d..9aa7c6c 100644 (file)
@@ -231,8 +231,15 @@ sub process_spool {
        $batch->strict_off;
 
        my $count = 0;
-       while (my $r = $batch->next) {
-        $logger->info("processing record $count");
+       my $r = -1;
+       while (try { $r = $batch->next } otherwise { $r = -1 }) {
+               if ($r == -1) {
+                       $logger->warn("Proccessing of record $count in set $fingerprint failed.  Skipping this record");
+                       $count++;
+               }
+
+               $logger->info("processing record $count");
+
                try {
                        (my $xml = $r->as_xml_record()) =~ s/\n//sog;
                        $xml =~ s/^<\?xml.+\?\s*>//go;