From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 918B51F454 for ; Sun, 8 Oct 2023 20:20:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1696796438; bh=jt7mr3cqYo0cjcDAfMvGNUqM50hnb7jcOL+i08dLiCo=; h=From:To:Subject:Date:From; b=hs2D9F6Uz4j5afLdBSZwZ/vDM3vS7LZex+sd58svLvJEJusDIj0GzxxGb6zNaoPG0 lzLxdnFK9WMFkvHmlDd4XYIITxowTe9zcOHGuAIvrznpKcBeMatjbtM04J71hJ0/z1 PoI8/B/hVYr1tIfdwG5GAcyN1+3w5futDEuU26vA= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] overidx: use croak/confess instead of die Date: Sun, 8 Oct 2023 20:19:40 +0000 Message-ID: <20231008201940.21537-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Unlike `die', `croak' can be expanded to `confess' to give a full backtrace. We'll use `confess' on transaction failures since that occasionally causes sporadic t/imapd.t failures on FreeBSD (IO::Kqueue is installed, so signals are deferred). --- lib/PublicInbox/OverIdx.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/OverIdx.pm b/lib/PublicInbox/OverIdx.pm index 5cea3706..aead375a 100644 --- a/lib/PublicInbox/OverIdx.pm +++ b/lib/PublicInbox/OverIdx.pm @@ -199,7 +199,7 @@ sub resolve_mid_to_tid { $tid // do { # create a new ghost my $id = mid2id($self, $mid); my $num = next_ghost_num($self); - $num < 0 or die "ghost num is non-negative: $num\n"; + $num < 0 or croak "BUG: ghost num is non-negative: $num\n"; $tid = next_tid($self); my $dbh = $self->{dbh}; $dbh->prepare_cached(<<'')->execute($num, $tid); @@ -283,7 +283,7 @@ sub _add_over { my ($self, $smsg, $mid, $refs, $old_tid, $v) = @_; my $cur_tid = $smsg->{tid}; my $n = $smsg->{num}; - die "num must not be zero for $mid" if !$n; + croak "BUG: num must not be zero for $mid" if !$n; my $cur_valid = $cur_tid > $self->{min_tid}; if ($n > 0) { # regular mail @@ -454,7 +454,7 @@ sub rollback_lazy { sub dbh_close { my ($self) = @_; - die "in transaction" if $self->{txn}; + Carp::confess('BUG: in transaction') if $self->{txn}; $self->SUPER::dbh_close; }