Don't abort when a file is not loadable
authorVincent Tondellier <tonton+hg@team1664.org>
Sun, 08 Feb 2015 23:59:59 +0100
changeset 60 7ad91b3d5562
parent 59 4f4f8a52a874
child 61 3a0ca02556da
Don't abort when a file is not loadable
bin/fs_to_db.pl
--- a/bin/fs_to_db.pl	Sun Feb 08 22:36:04 2015 +0100
+++ b/bin/fs_to_db.pl	Sun Feb 08 23:59:59 2015 +0100
@@ -47,10 +47,13 @@
 my $storage = $storage_class->new(config => $config->{Storage});
 
 foreach my $arg (@ARGV) {
-    my $pjson = decode_json(slurp $arg);
+    eval {
+        my $pjson = decode_json(slurp $arg);
 
-    my($filename, $dirs, $suffix) = fileparse($arg, qr/\.[^.]*/);
+        my($filename, $dirs, $suffix) = fileparse($arg, qr/\.[^.]*/);
 
-    my $uuid = $filename;
-    $storage->_db_insert_processed_data($uuid, $pjson);
+        my $uuid = $filename;
+        $storage->_db_insert_processed_data($uuid, $pjson);
+    };
+    warn $@ if $@;
 }