diff --git a/DakotaSender/App.config b/DakotaSender/App.config index a45c0d022..75ab64d7d 100644 --- a/DakotaSender/App.config +++ b/DakotaSender/App.config @@ -17,5 +17,11 @@ + + + + + + \ No newline at end of file diff --git a/DakotaSender/Program.cs b/DakotaSender/Program.cs index 9978933ef..d25c17e80 100644 --- a/DakotaSender/Program.cs +++ b/DakotaSender/Program.cs @@ -1,5 +1,6 @@ using BS.Shared; using BS.Shared.AppSender; +using BS.Shared.Core; using BS.Shared.DataContracts; using BS.Shared.DataContracts.GkvAbrechnung; using BS.Shared.Exceptions; @@ -46,7 +47,7 @@ namespace DakotaSender } catch (Exception e) { - PrintException(e); + HandleException(e, null); if (is_dakota_running) { @@ -99,7 +100,12 @@ namespace DakotaSender Print($"Verarbeite Datei: {file.SourceNutzdatendatei.Name}"); PrintLine($"(T:{file.Tenant}, U:{file.ApplicationUserOid}, P:{file.ProtokollOid}, D:{file.Datenannahmestelle})"); } - internal static void PrintException(Exception e) => PrintLine(e.ToString()); + internal static void HandleException(Exception e, string tenant) + { + MailUtils.SendGkvModuleErrorMail("GkvSender Exception", e, tenant); + + PrintLine(e.ToString()); + } static void CheckDakotaStatus() { @@ -158,6 +164,8 @@ namespace DakotaSender } static DakotaSystemFile ScanQueueFile(FileInfo auft) { + string tenant = null; + try { var nutz_fullname = auft.FullName.Substring(0, auft.FullName.Length - 4); @@ -172,7 +180,7 @@ namespace DakotaSender PrintLine($"- {auft.FullName}"); var split = nutz.Name.Split('_'); - var tenant = split[0]; + tenant = split[0]; var app_oid = long.Parse(split[1]); var p_oid = long.Parse(split[2]); var datenannahmestelle = split[3]; @@ -201,7 +209,7 @@ namespace DakotaSender } catch(Exception e) { - PrintException(e); + HandleException(e, tenant); } return null; @@ -409,11 +417,11 @@ namespace DakotaSender } catch (GkvException e) { - PrintException(e); + HandleException(e, tenant); } catch (Exception e) { - PrintException(e); + HandleException(e, tenant); } PrintSeperator();