Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
my $lineno = 0;
my $priority = 0;
+ my $parse_errors = '';
my $parse_line = sub {
my ($line) = @_;
}
};
- eval {
- while ($raw =~ /^\h*(.*?)\h*$/gm) {
- my $line = $1;
- $lineno++;
- next if !$line || $line =~ /^#/;
+ while ($raw =~ /^\h*(.*?)\h*$/gm) {
+ my $line = $1;
+ $lineno++;
+ next if !$line || $line =~ /^#/;
- $parse_line->($line);
+ eval { $parse_line->($line) };
+ if (my $err = $@) {
+ $parse_errors .= "line $lineno: $err";
}
- };
- if (my $err = $@) {
- die "error in '$fn' at $lineno: $err";
}
+ die "Encountered error(s) on parsing '$fn':\n$parse_errors" if $parse_errors;
return $config;
}
-[FenceConfig] error in 'fence_cfgs/connect-before-device-1.cfg' at 3: device 'first_dev' must be declared before you can connect to it
+[FenceConfig] Encountered error(s) on parsing 'fence_cfgs/connect-before-device-1.cfg':
+line 3: device 'first_dev' must be declared before you can connect to it
+line 4: device 'first_dev' must be declared before you can connect to it
-[FenceConfig] error in 'fence_cfgs/double-device-1.cfg' at 7: device 'unique_dev:1' already declared
+[FenceConfig] Encountered error(s) on parsing 'fence_cfgs/double-device-1.cfg':
+line 7: device 'unique_dev:1' already declared
+line 8: node 'node1' already connected to device 'unique_dev:1'