From 5eb6a7761db25fc55ffc55626a5311ca9295f8ca Mon Sep 17 00:00:00 2001 From: Xjph Date: Wed, 27 Oct 2021 22:07:41 -0230 Subject: [PATCH] Handle errors during monitoring. --- ObservatoryCore/LogMonitor.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ObservatoryCore/LogMonitor.cs b/ObservatoryCore/LogMonitor.cs index 162151c..2bcf4aa 100644 --- a/ObservatoryCore/LogMonitor.cs +++ b/ObservatoryCore/LogMonitor.cs @@ -344,7 +344,14 @@ namespace Observatory foreach (string line in fileContent.Skip(currentLine[eventArgs.FullPath])) { - DeserializeAndInvoke(line); + try + { + DeserializeAndInvoke(line); + } + catch (Exception ex) + { + ReportErrors(new List<(Exception ex, string file, string line)>() { (ex, eventArgs.Name, line) }); + } } currentLine[eventArgs.FullPath] = fileContent.Count;