From 5ecee3d2a058a47a6e16e217a266ecd2a3258e37 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 11 Feb 2025 03:55:34 +0000 Subject: [PATCH] search: async_mset: always run callback on exceptions To produce consistent error behavior, ensure we always run the user-supplied callback on exceptions when using in-process Xapian (as opposed to the external xap_helper process). --- lib/PublicInbox/Search.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index 784e3b0a4..cb1661016 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -493,8 +493,8 @@ sub async_mset { $cb->(@args, undef, $@) if $@; $ret; } else { # synchronous - my $mset = $self->mset($qry_str, $opt); - $cb->(@args, $mset); + my $mset = eval { $self->mset($qry_str, $opt) }; + $@ ? $cb->(@args, undef, $@) : $cb->(@args, $mset); undef; } } -- 2.47.3