Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Ignore harmless errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
trizen committed Jun 19, 2020
1 parent 3828920 commit 9880e01
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions bin/gtk-straw-viewer
Original file line number Diff line number Diff line change
Expand Up @@ -379,27 +379,30 @@ while (my ($key, $value) = each %objects) {
local $SIG{__WARN__} = sub {
my $warning = strip_spaces(join('', @_));

say STDERR $warning;

return if $warning =~ / at \(eval /;
return if $warning =~ /\bunhandled exception in callback:/;
return if $warning =~ /, or \} expected while parsing object\/hash/;

$warning = "[" . localtime(time) . "]: " . $warning . "\n";
print STDERR $warning;

set_text($warnings_textview, $warning, append => 1);
};

# __DIE__ handle
local $SIG{__DIE__} = sub {
my $error = join('', @_);
my $caller = [caller]->[0];
my $error = strip_spaces(join('', @_));

say STDERR $error;

# Ignore eval() errors
# Ignore harmless errors
return if $error =~ / at \(eval /;
return if $error =~ /, or \} expected while parsing object\/hash/;

# Just print the third-party errors,
# without displaying them to the user.
# Ignore third-party errors
if (not $caller =~ /^(?:main\z|WWW::StrawViewer\b)/) {
print STDERR "@_\n";
return;
}

Expand All @@ -415,6 +418,7 @@ local $SIG{__DIE__} = sub {
}
. "\n=>> Previous warnings:\n" . get_text($warnings_textview)
);

warn $error;
$errors_window->show;
return 1;
Expand Down

0 comments on commit 9880e01

Please sign in to comment.