about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiXSearch.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-09-15 22:47:00 +0000
committerEric Wong <e@80x24.org>2023-09-16 12:12:47 +0000
commit584d2d5fc4fb458792aef93c9802126d0722dfb1 (patch)
tree661c363861db2b7eb219d580276620435cf6500f /lib/PublicInbox/LeiXSearch.pm
parent4dcb50319432011d13f8134d37db0a395bfedc68 (diff)
downloadpublic-inbox-584d2d5fc4fb458792aef93c9802126d0722dfb1.tar.gz
Xapian can't parse every query, so ensure we set the
exit code for the client.
Diffstat (limited to 'lib/PublicInbox/LeiXSearch.pm')
-rw-r--r--lib/PublicInbox/LeiXSearch.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm
index 5965274c..7f4911b3 100644
--- a/lib/PublicInbox/LeiXSearch.pm
+++ b/lib/PublicInbox/LeiXSearch.pm
@@ -186,7 +186,8 @@ sub query_one_mset { # for --threads and l2m w/o sort
         }
         my $first_ids;
         do {
-                $mset = $srch->mset($mo->{qstr}, $mo);
+                $mset = eval { $srch->mset($mo->{qstr}, $mo) };
+                return $lei->child_error(22 << 8, "E: $@") if $@; # 22 from curl
                 mset_progress($lei, $dir, $mo->{offset} + $mset->size,
                                 $mset->get_matches_estimated);
                 wait_startq($lei); # wait for keyword updates
@@ -249,7 +250,8 @@ sub query_combined_mset { # non-parallel for non-"--threads" users
         }
         my $each_smsg = $lei->{ovv}->ovv_each_smsg_cb($lei);
         do {
-                $mset = $self->mset($mo->{qstr}, $mo);
+                $mset = eval { $self->mset($mo->{qstr}, $mo) };
+                return $lei->child_error(22 << 8, "E: $@") if $@; # 22 from curl
                 mset_progress($lei, 'xsearch', $mo->{offset} + $mset->size,
                                 $mset->get_matches_estimated);
                 wait_startq($lei); # wait for keyword updates