Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't die on log lines that aren't JSON.

  - Print the exeception when verbose option is enabled.
  • Loading branch information...
commit 88a4d3b508f4a71d0e19d26bd0d56d70c7f09479 1 parent de7dfae
@mikep mikep authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 bin/log-defer-viz
View
11 bin/log-defer-viz
@@ -6,6 +6,7 @@ use JSON::XS;
use Getopt::Long;
use Term::ANSIColor;
use Term::Size;
+use Try::Tiny;
use Log::Defer::Viz;
@@ -143,8 +144,14 @@ while (my $file = shift) {
}
while(<$fh>) {
- my $entry = decode_json($_);
- handle_entry($entry);
+ try {
+ my $entry = decode_json($_);
+ handle_entry($entry);
+ } catch {
+ if ($opt->{verbose}) {
+ print "Error parsing log line: $_";
+ }
+ }
}
close($fh);
Please sign in to comment.
Something went wrong with that request. Please try again.