diff options
author | Eric Wong <e@80x24.org> | 2022-08-10 15:58:01 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2022-08-10 20:11:10 +0000 |
commit | 69a839362deecd86771f306f20ff993f9c9c07c1 (patch) | |
tree | afa97ae342b24844e8702d17596f1109445df3c4 /lib/PublicInbox/IMAP.pm | |
parent | 1c457e08d2bb3352bdddde0a3580ff37f317cc72 (diff) | |
download | public-inbox-69a839362deecd86771f306f20ff993f9c9c07c1.tar.gz |
warn/carp usage is unavoidable given Perl itself and standard libraries, so just rely on localized $SIG{__WARN__} from 60d262483a4d6ddf (daemon: use per-listener SIG{__WARN__} callbacks, 2022-08-08) for all error reporting. While we're in the area, make some of the error handling more consistent between IMAP/NNTP/POP3.
Diffstat (limited to 'lib/PublicInbox/IMAP.pm')
-rw-r--r-- | lib/PublicInbox/IMAP.pm | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm index 2be1b763..0a65d87c 100644 --- a/lib/PublicInbox/IMAP.pm +++ b/lib/PublicInbox/IMAP.pm @@ -1165,17 +1165,11 @@ sub process_line ($$) { my $err = $@; if ($err && $self->{sock}) { $l =~ s/\r?\n//s; - err($self, 'error from: %s (%s)', $l, $err); + warn("error from: $l ($err)\n"); $tag //= '*'; - $res = "$tag BAD program fault - command not performed\r\n"; + $res = \"$tag BAD program fault - command not performed\r\n"; } - return 0 unless defined $res; - $self->write($res); -} - -sub err ($$;@) { - my ($self, $fmt, @args) = @_; - printf { $self->{imapd}->{err} } $fmt."\n", @args; + defined($res) ? $self->write($res) : 0; } sub out ($$;@) { |