avoid crashes if record in result set is corrupted
authorJoshua Ferraro <jmf@liblime.com>
Fri, 11 Apr 2008 09:50:51 +0000 (05:50 -0400)
committerJoshua Ferraro <jmf@liblime.com>
Fri, 11 Apr 2008 09:51:40 +0000 (04:51 -0500)
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/XSLT.pm

index 4a383fb..786bec8 100644 (file)
@@ -56,7 +56,12 @@ sub transformMARCXML4XSLT {
     my $biblio = GetBiblioData($biblionumber);
     my $frameworkcode = GetFrameworkCode($biblionumber);
     my $tagslib = &GetMarcStructure(1,$frameworkcode);
-    my @fields = $record->fields();
+    my @fields;
+    # FIXME: wish there was a better way to handle exceptions
+    eval {
+        @fields = $record->fields();
+    };
+    if ($@) { warn "PROBLEM WITH RECORD"; next; }
     my $list_of_authvalues = getAuthorisedValues4MARCSubfields($frameworkcode);
     for my $authvalue (@$list_of_authvalues) {
         for my $field ( $record->field($authvalue->{tagfield}) ) {