diff options
author | Eric Wong <e@80x24.org> | 2023-04-12 00:12:59 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-04-12 02:26:11 +0000 |
commit | d2186c03d688a0a4e4421d09803c7014b098243e (patch) | |
tree | 4d40ca154202400dd49d1369be085b2c27f56f19 /lib/PublicInbox/GzipFilter.pm | |
parent | d88fd934bf7b1a9270c278e747f76aaa05bc04e1 (diff) | |
download | public-inbox-d2186c03d688a0a4e4421d09803c7014b098243e.tar.gz |
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
Diffstat (limited to 'lib/PublicInbox/GzipFilter.pm')
-rw-r--r-- | lib/PublicInbox/GzipFilter.pm | 18 |
1 files changed, 8 insertions, 10 deletions
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 |