[svn:parrot] r48059 - branches/html_cleanup/tools/docs

jkeenan at svn.parrot.org jkeenan at svn.parrot.org
Fri Jul 9 02:07:36 UTC 2010


Author: jkeenan
Date: Fri Jul  9 02:07:35 2010
New Revision: 48059
URL: https://trac.parrot.org/parrot/changeset/48059

Log:
In case of failure to decode JSON, identify which .json file failed.

Modified:
   branches/html_cleanup/tools/docs/make_html_docs.pl

Modified: branches/html_cleanup/tools/docs/make_html_docs.pl
==============================================================================
--- branches/html_cleanup/tools/docs/make_html_docs.pl	Thu Jul  8 23:55:25 2010	(r48058)
+++ branches/html_cleanup/tools/docs/make_html_docs.pl	Fri Jul  9 02:07:35 2010	(r48059)
@@ -45,11 +45,19 @@
 
 # Transform the json
 my %pages;
-foreach my $index_file (glob 'docs/index/*.json') {
+my @json_index_files = glob 'docs/index/*.json';
+foreach my $index_file (@json_index_files) {
     my $contents;
     open my $fh, '<', $index_file;
     { local $/; $contents = <$fh>}
-    my $section = $json->decode($contents);
+    my $section = '';
+    eval {
+        $section = $json->decode($contents);
+    };
+    if ($@) {
+        say STDERR "Error in $index_file:";
+        die $@;
+    }
 
     my $outfile = $section->{page} . '.html';
     my $title   = $section->{title};


More information about the parrot-commits mailing list