From d2186c03d688a0a4e4421d09803c7014b098243e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 12 Apr 2023 00:12:59 +0000 Subject: gzip_filter: use carp in ->bail for failure checks carp is more useful since it shows the perspective of the caller and can be made to show a full backtrace with PERL5OPT=-MCarp=verbose --- lib/PublicInbox/GzipFilter.pm | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'lib/PublicInbox/GzipFilter.pm') diff --git a/lib/PublicInbox/GzipFilter.pm b/lib/PublicInbox/GzipFilter.pm index a11ba73f..a37080c8 100644 --- a/lib/PublicInbox/GzipFilter.pm +++ b/lib/PublicInbox/GzipFilter.pm @@ -18,6 +18,7 @@ use Compress::Raw::Zlib qw(Z_OK); use PublicInbox::CompressNoop; use PublicInbox::Eml; use PublicInbox::GitAsyncCat; +use Carp qw(carp); our @EXPORT_OK = qw(gzf_maybe); my %OPT = (-WindowBits => 15 + 16, -AppendOutput => 1); @@ -173,16 +174,13 @@ sub close { sub bail { my $self = shift; - if (my $env = $self->{env}) { - warn @_, "\n"; - my $http = $env->{'psgix.io'} or return; # client abort - eval { $http->close }; # should hit our close - warn "E: error in http->close: $@" if $@; - eval { $self->close }; # just in case... - warn "E: error in self->close: $@" if $@; - } else { - warn @_, "\n"; - } + carp @_; + my $env = $self->{env} or return; + my $http = $env->{'psgix.io'} or return; # client abort + eval { $http->close }; # should hit our close + carp "E: error in http->close: $@" if $@; + eval { $self->close }; # just in case... + carp "E: error in self->close: $@" if $@; } # this is public-inbox-httpd-specific -- cgit v1.2.3-24-ge0c7