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,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 1B7FC1F452 for ; Sat, 8 Apr 2023 09:30:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1680946252; bh=PdWZ0KW5hHt2wMjvPfmezMcWsR1G9Et+Q3Wc87sI+hU=; h=From:To:Subject:Date:From; b=Fv3bPNZvz7yrJruU6TGDSZ7gIoHagGNmVnS2J3J16D9cxcG38poOSt0I+oYdHJHzm AChoHzMTP6xk9VgJKEMHL+Bk3qNuVLyWXkQT/eQ3chi/YXqkw0rVJUOwh6kFK2N3Le jV7bN5FAwJGmWKvpfSSFqJRE3GoXT1X08gkM7mE8= From: Eric Wong To: spew@80x24.org Subject: [PATCH] gzip_filter: use carp in ->bail for failure checks Date: Sat, 8 Apr 2023 09:30:52 +0000 Message-Id: <20230408093052.861102-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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(-) 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