better error messages when a plugin fails

remove some debug messages in the log


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@89 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Ask Bjørn Hansen 2002-10-17 07:39:54 +00:00
parent 208a0cd54c
commit 173a2d26f5

View File

@ -24,7 +24,7 @@ sub log {
sub config { sub config {
my ($self, $c) = @_; my ($self, $c) = @_;
warn "SELF->config($c) ", ref $self; #warn "SELF->config($c) ", ref $self;
my %defaults = ( my %defaults = (
me => hostname, me => hostname,
@ -130,10 +130,13 @@ sub run_hooks {
if ($self->{_hooks}->{$hook}) { if ($self->{_hooks}->{$hook}) {
my @r; my @r;
for my $code (@{$self->{_hooks}->{$hook}}) { for my $code (@{$self->{_hooks}->{$hook}}) {
$self->log(1, "running plugin ", $code->{name}); $self->log(5, "running plugin ", $code->{name});
eval { (@r) = &{$code->{code}}($self->transaction, @_); }; eval { (@r) = &{$code->{code}}($self->transaction, @_); };
$@ and $self->log(0, "FATAL PLUGIN ERROR: ", $@) and next; $@ and $self->log(0, "FATAL PLUGIN ERROR: ", $@) and next;
$self->log(1, "a $hook hook returned undef!") and next unless defined $r[0]; !defined $r[0]
and $self->log(1, "plugin ".$code->{name}
."running the $hook hook returned undef!")
and next;
last unless $r[0] == DECLINED; last unless $r[0] == DECLINED;
} }
return @r; return @r;