mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-23 04:19:27 +01:00
Refresher: improve error handling
This commit is contained in:
parent
fb644a1a14
commit
a6fc2f6064
@ -27,10 +27,12 @@ sub refresh {
|
||||
my ($self, $from, $nick, $user, $host, $arguments) = @_;
|
||||
my $refresh_error;
|
||||
local $SIG{__WARN__} = sub {
|
||||
$refresh_error = shift;
|
||||
return if $refresh_error =~ /Can't undef active/;
|
||||
return if $refresh_error =~ /Subroutine \w+ redefined/;
|
||||
my $warning = shift;
|
||||
warn $warning and return if $warning =~ /Can't undef active/;
|
||||
warn $warning and return if $warning =~ /Subroutine \w+ redefined/;
|
||||
$refresh_error = $warning;
|
||||
$refresh_error =~ s/\s+Compilation failed in require at \/usr.*//;
|
||||
$refresh_error =~ s/in \@INC.*/in \@INC/;
|
||||
$self->{pbot}->{logger}->log("Error refreshing: $refresh_error\n");
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user