Ignore:
Timestamp:
Apr 3, 2019, 9:26:17 PM (4 months ago)
Author:
bruno
Message:

eval YAML LoadFile? to try to issue error messages and exit when error

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/lib/ProjectBuilder/Conf.pm

    r2397 r2402  
    229229
    230230    pb_log(1,"Loading YAML conf file $cf\n");
    231     my $lh0 = $ldfunc->($cf);
     231    my $lh0;
     232    eval { $lh0 = $ldfunc->($cf); };
     233    if ($@) {
     234        # Repeat to get the YAML error line
     235        $lh0 = $ldfunc->($cf);
     236        die "Unable to analyze YAML conf file $cf\n";
     237    }
    232238    foreach my $k (keys %$lh0) {
    233239        if (defined $lh->{$k}) {
     
    561567
    562568pb_log(0,"Converting v0 conf file $orig to v1 conf file $dest\n");
    563 # We can't just write the YAML if we want to ckeep comments !
     569# We can't just write the YAML if we want to keep comments !
    564570while (<ORIG>) {
    565571    if ($_ =~ /^#/) {
Note: See TracChangeset for help on using the changeset viewer.