Permalink
Browse files

Try to continue after DB read error.

  • Loading branch information...
pjcj committed Jul 19, 2013
1 parent ba0f04a commit d99a5ad930145a9e1136bae15e4ae50304194702
Showing with 9 additions and 5 deletions.
  1. +9 −5 lib/Devel/Cover/DB.pm
View
@@ -87,12 +87,16 @@ sub all_criteria_short { @{$_[0]->{all_criteria_short}} }
sub read
{
- my $self = shift;
- my ($file) = @_;
+ my $self = shift;
+ my ($file) = @_;
- my $io = Devel::Cover::DB::IO->new;
- my $db = $io->read($file);
- $self->{runs} = $db->{runs};
+ my $io = Devel::Cover::DB::IO->new;
+ my $db = eval { $io->read($file) };
+ if ($@ or !$db) {
+ warn $@;
+ } else {
+ $self->{runs} = $db->{runs};
+ }
$self
}

0 comments on commit d99a5ad

Please sign in to comment.