From 49c6ebf9c7e926dee43f30653a7602d95bcaf122 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Wed, 24 Aug 2016 15:42:24 +0200 Subject: [PATCH] FileWriter or Printer crash handled, different writers/printers do not interfere with each other and results are always saved to DB. --- .../BenchControl/Sequences/MainSeq.cs | 20 +++++++++++++++++-- .../Resources/Strings.Designer.cs | 18 +++++++++++++++++ TestBenchFramework/Resources/Strings.resx | 6 ++++++ 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs index 3d8a02428..dc5ec7d30 100644 --- a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs +++ b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs @@ -772,7 +772,15 @@ namespace TBF.BenchControl.Sequences IResultsWriter writer = TbfComponents.FindComponent(writerName) as IResultsWriter; if (writer != null) { - savingAndPrintingRslts.AddOperation(writer.WriteResultsOp(ProcessData.BatchRslts.Batch)); + try + { + savingAndPrintingRslts.AddOperation(writer.WriteResultsOp(ProcessData.BatchRslts.Batch)); + } + catch (Exception exc) + { + Bridge.OnError(this, string.Format(Strings.Component_0_crashed_Results_not_saved, writerName)); + log.FatalFormat("FileWriter {0} crashed: {1}", writerName, exc.Message); + } } } @@ -782,7 +790,15 @@ namespace TBF.BenchControl.Sequences IResultsPrinter printer = TbfComponents.FindComponent(printerName) as IResultsPrinter; if (printer != null && !printer.SupressPrinting) { - savingAndPrintingRslts.AddOperation(printer.PrintResultsOp(ProcessData.BatchRslts.Batch)); + try + { + savingAndPrintingRslts.AddOperation(printer.PrintResultsOp(ProcessData.BatchRslts.Batch)); + } + catch (Exception exc) + { + Bridge.OnError(this, string.Format(Strings.Component_0_crashed_Results_not_printed, printerName)); + log.FatalFormat("Printer {0} crashed: {1}", printerName, exc.Message); + } } } diff --git a/TestBenchFramework/Resources/Strings.Designer.cs b/TestBenchFramework/Resources/Strings.Designer.cs index d74211f92..b5fc168e2 100644 --- a/TestBenchFramework/Resources/Strings.Designer.cs +++ b/TestBenchFramework/Resources/Strings.Designer.cs @@ -645,6 +645,24 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to Component {0} crashed. Results not printed.. + /// + internal static string Component_0_crashed_Results_not_printed { + get { + return ResourceManager.GetString("Component_0_crashed_Results_not_printed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Component {0} crashed. Results not saved.. + /// + internal static string Component_0_crashed_Results_not_saved { + get { + return ResourceManager.GetString("Component_0_crashed_Results_not_saved", resourceCulture); + } + } + /// /// Looks up a localized string similar to Compound. /// diff --git a/TestBenchFramework/Resources/Strings.resx b/TestBenchFramework/Resources/Strings.resx index 3de837a95..6957ca07d 100644 --- a/TestBenchFramework/Resources/Strings.resx +++ b/TestBenchFramework/Resources/Strings.resx @@ -1558,4 +1558,10 @@ Parent name + + Component {0} crashed. Results not printed. + + + Component {0} crashed. Results not saved. + \ No newline at end of file