From c5c5789a889b4e0ce4181344b8c243dabf230b75 Mon Sep 17 00:00:00 2001 From: dymanoid <9433345+dymanoid@users.noreply.github.com> Date: Sat, 7 Jul 2018 15:02:30 +0200 Subject: [PATCH] Change exception logging to be more verbose --- src/RealTime/Config/ConfigurationProvider.cs | 4 ++-- src/RealTime/Core/RealTimeCore.cs | 4 ++-- src/RealTime/Events/Storage/CityEventsLoader.cs | 2 +- src/RealTime/GameConnection/ResidentAIHook.cs | 2 +- src/RealTime/GameConnection/TouristAIHook.cs | 2 +- src/RealTime/Localization/LocalizationProvider.cs | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/RealTime/Config/ConfigurationProvider.cs b/src/RealTime/Config/ConfigurationProvider.cs index dc99b7e4..36ab31a1 100644 --- a/src/RealTime/Config/ConfigurationProvider.cs +++ b/src/RealTime/Config/ConfigurationProvider.cs @@ -36,7 +36,7 @@ public static RealTimeConfig LoadConfiguration() } catch (Exception ex) { - Log.Warning($"The ' Real Time' mod has encountered an error while trying to load the configuration, error message: " + ex.Message); + Log.Warning($"The 'Real Time' mod has encountered an error while trying to load the configuration, error message: " + ex); return new RealTimeConfig(); } } @@ -61,7 +61,7 @@ public static void SaveConfiguration(RealTimeConfig config) } catch (Exception ex) { - Log.Error("The 'Real Time' mod cannot save its configuration, error message: " + ex.Message); + Log.Error("The 'Real Time' mod cannot save its configuration, error message: " + ex); } } diff --git a/src/RealTime/Core/RealTimeCore.cs b/src/RealTime/Core/RealTimeCore.cs index 348fca55..3bfd66f6 100644 --- a/src/RealTime/Core/RealTimeCore.cs +++ b/src/RealTime/Core/RealTimeCore.cs @@ -86,7 +86,7 @@ public static RealTimeCore Run(RealTimeConfig config, string rootPath, Localizat Log.Warning("Failed to revert method redirections while cleaning up a failed patching"); } - Log.Error("Failed to perform method redirections: " + ex.Message); + Log.Error("The 'Real Time' mod failed to perform method redirections: " + ex); return null; } @@ -198,7 +198,7 @@ public void Stop() } catch (Exception ex) { - Log.Error("Failed to revert method redirections: " + ex.Message); + Log.Error("The 'Real Time' mod failed to revert method redirections: " + ex); } isEnabled = false; diff --git a/src/RealTime/Events/Storage/CityEventsLoader.cs b/src/RealTime/Events/Storage/CityEventsLoader.cs index bb231bb4..32db2340 100644 --- a/src/RealTime/Events/Storage/CityEventsLoader.cs +++ b/src/RealTime/Events/Storage/CityEventsLoader.cs @@ -136,7 +136,7 @@ private void LoadEvents(IEnumerable files) } catch (Exception ex) { - Log.Error($"The 'Real Time' mod was unable to load an event template from file '{file}', error message: '{ex.Message}'"); + Log.Error($"The 'Real Time' mod was unable to load an event template from file '{file}', error message: {ex}"); } } diff --git a/src/RealTime/GameConnection/ResidentAIHook.cs b/src/RealTime/GameConnection/ResidentAIHook.cs index 5cd9f039..3f769050 100644 --- a/src/RealTime/GameConnection/ResidentAIHook.cs +++ b/src/RealTime/GameConnection/ResidentAIHook.cs @@ -60,7 +60,7 @@ StartMovingWithOfferDelegate startMovingWithOffer } catch (Exception e) { - Log.Error($"The 'Real Time' mod failed to create a delegate for type 'ResidentAI', no method patching for the class: '{e.Message}'"); + Log.Error("The 'Real Time' mod failed to create a delegate for type 'ResidentAI', no method patching for the class: " + e); return null; } } diff --git a/src/RealTime/GameConnection/TouristAIHook.cs b/src/RealTime/GameConnection/TouristAIHook.cs index 3ccebc2c..60178cb8 100644 --- a/src/RealTime/GameConnection/TouristAIHook.cs +++ b/src/RealTime/GameConnection/TouristAIHook.cs @@ -64,7 +64,7 @@ StartMovingDelegate startMoving } catch (Exception e) { - Log.Error($"The 'Real Time' mod failed to create a delegate for type 'TouristAI', no method patching for the class: '{e.Message}'"); + Log.Error("The 'Real Time' mod failed to create a delegate for type 'TouristAI', no method patching for the class: " + e); return null; } } diff --git a/src/RealTime/Localization/LocalizationProvider.cs b/src/RealTime/Localization/LocalizationProvider.cs index defed312..538f691c 100644 --- a/src/RealTime/Localization/LocalizationProvider.cs +++ b/src/RealTime/Localization/LocalizationProvider.cs @@ -137,7 +137,7 @@ private LoadingResult Load(string language) } catch (Exception ex) { - Log.Error($"The 'Real Time' cannot load data from localization file '{path}', error message: {ex.Message}"); + Log.Error($"The 'Real Time' cannot load data from localization file '{path}', error message: {ex}"); translation.Clear(); return LoadingResult.Failure; }