Constructor fails politely (warns and returns undef) if the registry
authorMike Taylor <mike@indexdata.com>
Thu, 20 Dec 2007 12:31:09 +0000 (12:31 +0000)
committerMike Taylor <mike@indexdata.com>
Thu, 20 Dec 2007 12:31:09 +0000 (12:31 +0000)
search fails, whereas previously it would throw an exception which,
uncaught, would stop the overnight IRSpy run.  The junk ID in question
is
//lucasportal.info/blogs/payday-usa">'</a>night:G<a href="http://lucasportal.info/blogs/payday-usa">'</a>night/Illepeliz
(sic) which yields BIB-1 diagnostic 108 "Malformed query" on
irspy.indexdata.com but NOT on my development box, for reason that I
do not yet understand.

lib/ZOOM/IRSpy/Connection.pm

index 61aa856..0d68df2 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Connection.pm,v 1.19 2007-12-18 11:59:42 mike Exp $
+# $Id: Connection.pm,v 1.20 2007-12-20 12:31:09 mike Exp $
 
 package ZOOM::IRSpy::Connection;
 
 
 package ZOOM::IRSpy::Connection;
 
@@ -51,7 +51,11 @@ sub create {
     eval {
        $rs = $irspy->{conn}->search(new ZOOM::Query::CQL($query));
     }; if ($@) {
     eval {
        $rs = $irspy->{conn}->search(new ZOOM::Query::CQL($query));
     }; if ($@) {
-       die "registry search for record '$id' had error: '$@'";
+       # This should be a "can't happen", but junk entries such as
+       #       //lucasportal.info/blogs/payday-usa">'</a>night:G<a href="http://lucasportal.info/blogs/payday-usa">'</a>night/Illepeliz
+       # (yes, really) yield BIB-1 diagnostic 108 "Malformed query"
+       warn "registry search for record '$id' had error: '$@'";
+       return undef;
     }
     my $n = $rs->size();
     $this->log("irspy", "query '$query' found $n record", $n==1 ? "" : "s");
     }
     my $n = $rs->size();
     $this->log("irspy", "query '$query' found $n record", $n==1 ? "" : "s");