]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
searchidxshard: use BUG error messages more consistently
authorEric Wong <e@80x24.org>
Tue, 25 Apr 2023 11:02:56 +0000 (11:02 +0000)
committerEric Wong <e@80x24.org>
Tue, 25 Apr 2023 20:58:32 +0000 (20:58 +0000)
We'll also drop the "\n" for die() to make diagnostics easier.
There's no known bugs in this area, just consistency
improvements and LoC reduction.

lib/PublicInbox/SearchIdxShard.pm

index 831be51b87c54377f1dfbb4b00ab986606f1bd96..21bd56c2794517f20c704361312abb06c3ad7df3 100644 (file)
@@ -32,12 +32,10 @@ sub new {
        $self;
 }
 
-sub _worker_done {
+sub _worker_done { # OnDestroy cb
        my ($self) = @_;
-       if ($self->need_xapian) {
-               die "$$ $0 xdb not released\n" if $self->{xdb};
-       }
-       die "$$ $0 still in transaction\n" if $self->{txn};
+       die "BUG: $$ $0 xdb active" if $self->need_xapian && $self->{xdb};
+       die "BUG: $$ $0 txn active" if $self->{txn};
 }
 
 sub ipc_atfork_child { # called automatically before ipc_worker_loop
@@ -64,7 +62,7 @@ sub echo {
 
 sub idx_close {
        my ($self) = @_;
-       die "transaction in progress $self\n" if $self->{txn};
+       die "BUG: $$ $0 txn active" if $self->{txn};
        $self->idx_release if $self->{xdb};
 }