More robust error handling, especially before logging can be initialized

This commit is contained in:
Robert McRackan 2021-09-23 09:19:35 -04:00
parent 61385f0f0b
commit 4fd16f04e0
5 changed files with 100 additions and 34 deletions

View file

@ -1,6 +1,5 @@
using LibationWinForms.Dialogs;
using System;
using System.Linq;
using System;
using LibationWinForms.Dialogs;
namespace LibationWinForms
{
@ -15,7 +14,11 @@ namespace LibationWinForms
/// <returns>One of the System.Windows.Forms.DialogResult values.</returns>
public static System.Windows.Forms.DialogResult Show(string text, string caption, Exception exception)
{
Serilog.Log.Logger.Error(exception, "Alert admin error: {@DebugText}", new { text, caption });
try
{
Serilog.Log.Logger.Error(exception, "Alert admin error: {@DebugText}", new { text, caption });
}
catch { }
using var form = new MessageBoxAlertAdminDialog(text, caption, exception);
return form.ShowDialog();