Skip to content

Commit

Permalink
Check for json-ness of config file, report a useful debug message if …
Browse files Browse the repository at this point in the history
…we get an error.
  • Loading branch information
James Allen committed Sep 10, 2020
1 parent 9169551 commit 51acb40
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/Bio/EnsEMBL/DataCheck/Manager.pm
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,11 @@ sub load_config {
die "Config file does not exist" unless -e $self->config_file;

my $json = path($self->config_file)->slurp;
my %config = %{ JSON->new->decode($json) };
my %config;
eval {
%config = %{ JSON->new->decode($json) };
};
die $self->config_file . " is not a valid json file:\n$@" if $@;

foreach my $key (keys %{$config{'datacheck_params'}}) {
if (!exists $params{$key}) {
Expand Down

0 comments on commit 51acb40

Please sign in to comment.