better logging.
[irspy-moved-to-github.git] / lib / ZOOM / IRSpy.pm
index 13b34a6..7c99f09 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: IRSpy.pm,v 1.68 2007-02-23 16:45:55 mike Exp $
+# $Id: IRSpy.pm,v 1.70 2007-02-26 22:20:08 mike Exp $
 
 package ZOOM::IRSpy;
 
@@ -199,8 +199,9 @@ sub initialise {
 
     $this->log("irspy_debug", "query '", $this->{query}, "'");
     my $rs = $this->{conn}->search(new ZOOM::Query::CQL($this->{query}));
+    $this->log("irspy", "'", $this->{query}, "' found ",
+              $rs->size(), " target records");
     delete $this->{query};     # No longer needed at all
-    $this->log("irspy_debug", "found ", $rs->size(), " target records");
     my $gatherTargets = !$this->{targets};
     foreach my $i (1 .. $rs->size()) {
        my $target = _render_record($rs, $i-1, "id");
@@ -437,11 +438,13 @@ sub check {
        die "$conn has no current task for event $ev ($evstr)" if !$task;
 
        my $res;
-       eval { $conn->_check() };
-       if ($@) {
+       eval { $conn->check() };
+       if ($@ && ref $@ && $@->isa("ZOOM::Exception")) {
            my $sub = $task->{cb}->{exception};
            die $@ if !defined $sub;
            $res = &$sub($conn, $task, $task->udata(), $@);
+       } elsif ($@) {
+           die "Unexpected non-ZOOM exception: " . ref($@) . " ($@)";
        } else {
            my $sub = $task->{cb}->{$ev};
            if (!defined $sub) {