From 7bb5a97696607d6ce5f21d08718d063b6cf0682b Mon Sep 17 00:00:00 2001 From: Xjph Date: Mon, 6 Sep 2021 18:18:54 -0230 Subject: [PATCH] include file name in error report --- ObservatoryCore/LogMonitor.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ObservatoryCore/LogMonitor.cs b/ObservatoryCore/LogMonitor.cs index 7282314..231345a 100644 --- a/ObservatoryCore/LogMonitor.cs +++ b/ObservatoryCore/LogMonitor.cs @@ -246,7 +246,7 @@ namespace Observatory } catch (Exception ex) { - readErrors.Add((ex, "Pre-read", line)); + readErrors.Add((ex, file, line)); } } return readErrors; @@ -279,7 +279,16 @@ namespace Observatory int count = 0; foreach (var error in readErrors) { - errorContent.AppendLine(error.ex.InnerException.Message); + + if (error.ex.InnerException == null) + { + errorContent.AppendLine(error.ex.Message); + } + else + { + errorContent.AppendLine(error.ex.InnerException.Message); + } + errorContent.AppendLine($"File: {error.file}"); if (error.line.Length > 200) {