Commit f461a60a authored by Francesc Guasch's avatar Francesc Guasch
Browse files

[

parent ff4d9a3e
......@@ -770,7 +770,13 @@ sub _init_config {
my $connector = shift;
confess "Deprecated connector" if $connector;
$CONFIG = YAML::LoadFile($file);
die "ERROR: Missing config file $file\n"
if !-e $file;
eval { $CONFIG = YAML::LoadFile($file) };
die "ERROR: Format error in config file $file\n$@" if $@;
$CONFIG->{vm} = [] if !$CONFIG->{vm};
$LIMIT_PROCESS = $CONFIG->{limit_process}
......
......@@ -19,4 +19,16 @@ ok($Ravada::CONNECTOR, "Now we should have a DB connector ");
ok($Ravada::CONNECTOR,"No connector defined ");
eval { ok($Ravada::CONNECTOR->dbh,"No dbh defined ") };
eval {
my $config_err = "t/etc/ravada_miss.conf";
my $rvd_err = Ravada->new( connector => $test->connector, config => $config_err);
};
like($@,qr/Missing config file/);
eval {
my $config_err = "t/etc/ravada_err.conf";
my $rvd_err = Ravada->new( connector => $test->connector, config => $config_err);
};
like($@,qr/Format error/);
done_testing();
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment