* [PATCH] overidx: use croak/confess instead of die
@ 2023-10-08 20:19 7% Eric Wong
0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2023-10-08 20:19 UTC (permalink / raw)
To: meta
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;
}
^ permalink raw reply related [relevance 7%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-10-08 20:19 7% [PATCH] overidx: use croak/confess instead of die Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).