summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
1c457e0)
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.
if ($@ || !$self->{sock}) { # something bad happened...
delete $self->{long_cb};
my $elapsed = now() - $t0;
if ($@ || !$self->{sock}) { # something bad happened...
delete $self->{long_cb};
my $elapsed = now() - $t0;
- $@ and $self->err("%s during long response[$fd] - %0.6f",
- $@, $elapsed);
+ $@ and warn("$@ during long response[$fd] - ",
+ sprintf('%0.6f', $elapsed),"\n");
$self->out(" deferred[$fd] aborted - %0.6f", $elapsed);
$self->close;
} elsif ($more) { # $self->{wbuf}:
$self->out(" deferred[$fd] aborted - %0.6f", $elapsed);
$self->close;
} elsif ($more) { # $self->{wbuf}:
my ($class, $self) = @_;
my ($in, $err) = Compress::Raw::Zlib::Inflate->new(%IN_OPT);
if ($err != Z_OK) {
my ($class, $self) = @_;
my ($in, $err) = Compress::Raw::Zlib::Inflate->new(%IN_OPT);
if ($err != Z_OK) {
- $self->err("Inflate->new failed: $err");
+ warn("Inflate->new failed: $err\n");
return;
}
bless $self, $class;
return;
}
bless $self, $class;
my $err = $@;
if ($err && $self->{sock}) {
$l =~ s/\r?\n//s;
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");
- $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;
my $res = eval { $req->($self, @args) };
my $err = $@;
if ($err && $self->{sock}) {
my $res = eval { $req->($self, @args) };
my $err = $@;
if ($err && $self->{sock}) {
- local $/ = "\n";
- chomp($l);
- err($self, 'error from: %s (%s)', $l, $err);
+ $l =~ s/\r?\n//s;
+ warn("error from: $l ($err)\n");
$res = \"503 program fault - command not performed\r\n";
}
defined($res) ? $self->write($res) : 0;
$res = \"503 program fault - command not performed\r\n";
}
defined($res) ? $self->write($res) : 0;
'223 '.join(' ', sort(@paths))."\r\n";
}
'223 '.join(' ', sort(@paths))."\r\n";
}
-sub err ($$;@) {
- my ($self, $fmt, @args) = @_;
- printf { $self->{nntpd}->{err} } $fmt."\n", @args;
-}
-
sub out ($$;@) {
my ($self, $fmt, @args) = @_;
printf { $self->{nntpd}->{out} } $fmt."\n", @args;
sub out ($$;@) {
my ($self, $fmt, @args) = @_;
printf { $self->{nntpd}->{out} } $fmt."\n", @args;
# XXX FIXME: duplicated stuff from NNTP.pm and IMAP.pm
# XXX FIXME: duplicated stuff from NNTP.pm and IMAP.pm
-sub err ($$;@) {
- my ($self, $fmt, @args) = @_;
- printf { $self->{pop3d}->{err} } $fmt."\n", @args;
-}
-
sub out ($$;@) {
my ($self, $fmt, @args) = @_;
printf { $self->{pop3d}->{out} } $fmt."\n", @args;
sub out ($$;@) {
my ($self, $fmt, @args) = @_;
printf { $self->{pop3d}->{out} } $fmt."\n", @args;
\"-ERR command not recognized\r\n";
my $err = $@;
if ($err && $self->{sock}) {
\"-ERR command not recognized\r\n";
my $err = $@;
if ($err && $self->{sock}) {
- chomp($l);
- err($self, 'error from: %s (%s)', $l, $err);
+ $l =~ s/\r?\n//s;
+ warn("error from: $l ($err)\n");
$res = \"-ERR program fault - command not performed\r\n";
}
defined($res) ? $self->write($res) : 0;
$res = \"-ERR program fault - command not performed\r\n";
}
defined($res) ? $self->write($res) : 0;