adding an eval to prevent an execption when getting marc biblio
authortoins <toins>
Fri, 20 Jul 2007 08:34:58 +0000 (08:34 +0000)
committertoins <toins>
Fri, 20 Jul 2007 08:34:58 +0000 (08:34 +0000)
misc/cronjobs/build_browser_and_cloud.pl

index 490d542..dea5318 100755 (executable)
@@ -54,7 +54,6 @@ warn "browser : $browser_tag / $browser_subfield";
 die "no cloud or browser field/subfield defined : nothing to do !" unless $browser_tag or $cloud_tag;
 
 my $dbh = C4::Context->dbh;
-my $starttime = time();
 
 my $i=0;
 $|=1; # flushes output
@@ -78,7 +77,14 @@ while ((my ($biblionumber)= $sth->fetchrow)) {
     $i++;
     print "." unless $batch;
     #now, parse the record, extract the item fields, and store them in somewhere else.
-    my $Koharecord = GetMarcBiblio($biblionumber);
+    my $Koharecord;
+    eval{
+           $Koharecord = GetMarcBiblio($biblionumber);
+    };
+    if($@){
+           warn 'pb when getting biblio '.$i.' : '.$@;
+           next;
+    }
     # deal with BROWSER part
     if ($browser_tag) { 
         foreach my $browsed_field ($Koharecord->subfield($browser_tag,$browser_subfield)) {
@@ -117,8 +123,8 @@ if ($browser_tag) {
     }
     $classification = dewey_french();
     # calculate end node...
-    use Data::Dumper;
-    warn "==>".Dumper(%browser_result);
+    #use Data::Dumper;
+    #warn "==>".Dumper(%browser_result);
     foreach (keys %browser_result) {
         my $father = substr($_,0,-1);
         $browser_result{$father}->{notendnode}=1;
@@ -1504,4 +1510,4 @@ return {
     "999" => "de l'Antarctique",
 }
 ;
-}
\ No newline at end of file
+}