X-Git-Url: http://git.indexdata.com/?p=irspy-moved-to-github.git;a=blobdiff_plain;f=lib%2FZOOM%2FIRSpy%2FConnection.pm;h=469968eb5278217098c00ba736801696276037f0;hp=f5aa5690d49be41dc932659542a4e1b1ced4c052;hb=ab426bd5b47b1aa30ef81432efa0bc2575abf3e6;hpb=7000d72c8cf061be6be741b1d66354ce92697b33 diff --git a/lib/ZOOM/IRSpy/Connection.pm b/lib/ZOOM/IRSpy/Connection.pm index f5aa569..469968e 100644 --- a/lib/ZOOM/IRSpy/Connection.pm +++ b/lib/ZOOM/IRSpy/Connection.pm @@ -1,4 +1,4 @@ -# $Id: Connection.pm,v 1.15 2007-05-01 15:33:30 mike Exp $ +# $Id: Connection.pm,v 1.21 2007-12-20 12:35:01 mike Exp $ package ZOOM::IRSpy::Connection; @@ -47,9 +47,22 @@ sub create { $this->{tasks} = []; my $query = cql_target($id); - my $rs = $irspy->{conn}->search(new ZOOM::Query::CQL($query)); + my $rs; + eval { + $rs = $irspy->{conn}->search(new ZOOM::Query::CQL($query)); + }; if ($@) { + # This should be a "can't happen", but junk entries such as + # //lucasportal.info/blogs/payday-usa">'night:G'night/Illepeliz + # (yes, really) yield BIB-1 diagnostic 108 "Malformed query" + warn "registry search for record '$id' had error: '$@' -- skipping"; + return undef; + } my $n = $rs->size(); - $this->log("irspy", "query '$query' found $n records"); + $this->log("irspy", "query '$query' found $n record", $n==1 ? "" : "s"); + ### More than 1 hit is always an error and indicates duplicate + # records in the database; no hits is fine for a new target + # being probed for the first time, but not if the connection is + # being created as part of an "all known targets" scan. my $zeerex; $zeerex = render_record($rs, 0, "zeerex") if $n > 0; $this->{record} = new ZOOM::IRSpy::Record($this, $target, $zeerex); @@ -136,6 +149,7 @@ sub irspy_search { my $this = shift(); my($qtype, $qstr, $udata, $options, %cb) = @_; + #warn "calling $this->irspy_search(", join(", ", @_), ")\n"; $this->add_task(new ZOOM::IRSpy::Task::Search ($qtype, $qstr, $this, $udata, $options, %cb)); }