3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-26 22:09:26 +01:00

Refresher: improve error handling

This commit is contained in:
Pragmatic Software 2020-02-16 12:36:30 -08:00
parent fb644a1a14
commit a6fc2f6064

View File

@ -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");
};