[gbrainy] If a file produces an exception, continue processing the rest of the files



commit 93cfab9c7951fc302fdedbcc50f78ba52fd7437f
Author: Jordi Mas <jmas softcatala org>
Date:   Sun Jan 28 18:06:26 2018 +0100

    If a file produces an exception, continue processing the rest of the files

 tools/TranslationsChecker.cs |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/tools/TranslationsChecker.cs b/tools/TranslationsChecker.cs
index 6a0f4a1..51f4386 100644
--- a/tools/TranslationsChecker.cs
+++ b/tools/TranslationsChecker.cs
@@ -140,6 +140,18 @@ public class GameXmlToGetString
                }
        }
 
+        static void ParseFile (string file)
+        {
+                try {
+                       Console.WriteLine ("Openning {0}", file);
+                       Parser parser = new Parser (file, Encoding.UTF8);
+                       parser.Parse ();
+                }
+                catch (Exception e) {
+                        Console.WriteLine ("Error parsing {0}: {1}", file, e);
+                }
+        }
+
        /*
                This tool scans the LINGUAS files and searches for potential
                mismatching string formatters and expression variables that can
@@ -159,11 +171,8 @@ public class GameXmlToGetString
                        if (line.StartsWith ("#") == true)
                                continue;
 
-                       file = "../po/" + line + ".po";
-
-                       Console.WriteLine ("Openning {0}", file);
-                       Parser parser = new Parser (file, Encoding.UTF8);
-                       parser.Parse ();
+                        file = "../po/" + line + ".po";
+                        ParseFile(file);
                }
        }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]