From 584d2d5fc4fb458792aef93c9802126d0722dfb1 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 15 Sep 2023 22:47:00 +0000 Subject: lei q: set exit code for invalid Xapian queries Xapian can't parse every query, so ensure we set the exit code for the client. --- lib/PublicInbox/LeiXSearch.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox/LeiXSearch.pm') 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 -- cgit v1.2.3-24-ge0c7