diff --git a/UFEDLib/ModelParser.cs b/UFEDLib/ModelParser.cs index b792ec4..3adf97d 100644 --- a/UFEDLib/ModelParser.cs +++ b/UFEDLib/ModelParser.cs @@ -16,8 +16,7 @@ public class ModelParser { if(!File.Exists(xmlReportFile)) { - Console.WriteLine("File not found: " + xmlReportFile); - return new List(); + throw new FileNotFoundException("File not found: " + xmlReportFile, xmlReportFile); } // get file size @@ -79,6 +78,8 @@ public class ModelParser catch (Exception ex) { Console.WriteLine("Error parsing report.xml: " + ex.Message); + if (debugAttributes) + throw; } } } @@ -87,6 +88,7 @@ public class ModelParser catch (Exception ex) { Console.WriteLine("Error parsing report.xml" + ex.ToString()); + throw; } finally { @@ -103,8 +105,7 @@ public class ModelParser if(!File.Exists(ufdrFileName)) { - Console.WriteLine("File not found: " + ufdrFileName); - return results; + throw new FileNotFoundException("File not found: " + ufdrFileName, ufdrFileName); } try @@ -117,8 +118,7 @@ public class ModelParser if (report == null) { - Console.WriteLine("report.xml not found in the ufdr file"); - return null; + throw new InvalidDataException("report.xml not found in the ufdr file: " + ufdrFileName); } reportSize = report.Length; @@ -177,6 +177,8 @@ public class ModelParser catch (Exception ex) { Console.WriteLine("Error parsing report.xml: " + ex.Message); + if (debugAttributes) + throw; } } } @@ -187,6 +189,7 @@ public class ModelParser catch (Exception ex) { Console.WriteLine("Error parsing report.xml: " + ex.ToString()); + throw; } finally { @@ -199,13 +202,12 @@ public class ModelParser - public static List ScanModels( string fileName, IProgress progress = null) + public static List ScanModels( string fileName, IProgress progress = null, bool debugAttributes = false) { List models = new List(); if (!File.Exists(fileName)) { - Console.WriteLine("File not found: " + fileName); - return models; + throw new FileNotFoundException("File not found: " + fileName, fileName); } try { @@ -277,6 +279,8 @@ public static List ScanModels( string fileName, IProgress progress catch (Exception ex) { Console.WriteLine("Error parsing report.xml: " + ex.Message); + if (debugAttributes) + throw; } } } @@ -285,6 +289,7 @@ public static List ScanModels( string fileName, IProgress progress catch (Exception ex) { Console.WriteLine("Error parsing report.xml: " + ex.ToString()); + throw; } finally { @@ -304,8 +309,7 @@ public static List ScanModels( string fileName, IProgress progress if (report == null) { - Console.WriteLine("report.xml not found in the ufdr file"); - return null; + throw new InvalidDataException("report.xml not found in the ufdr file: " + fileName); } reportSize = report.Length; @@ -374,6 +378,8 @@ public static List ScanModels( string fileName, IProgress progress catch (Exception ex) { Console.WriteLine("Error parsing ufdr: " + ex.Message); + if (debugAttributes) + throw; } } } @@ -384,6 +390,7 @@ public static List ScanModels( string fileName, IProgress progress catch (Exception ex) { Console.WriteLine("Error parsing ufdr: " + ex.ToString()); + throw; } finally { @@ -395,6 +402,7 @@ public static List ScanModels( string fileName, IProgress progress catch (Exception ex) { Console.WriteLine("Error parsing report: " + ex.ToString()); + throw; } return models; } diff --git a/UFEDLib/UFEDLib.csproj b/UFEDLib/UFEDLib.csproj index 12f7ae6..6d83c9e 100644 --- a/UFEDLib/UFEDLib.csproj +++ b/UFEDLib/UFEDLib.csproj @@ -5,7 +5,7 @@ disable enable True - 0.2.15 + 0.2.16 ufedlibdotnet False None