diff --git a/Wabbajack.Common/Utils.cs b/Wabbajack.Common/Utils.cs index 2ab9d218..c95b77e8 100644 --- a/Wabbajack.Common/Utils.cs +++ b/Wabbajack.Common/Utils.cs @@ -72,6 +72,11 @@ namespace Wabbajack.Common { LogToFile(err.ShortDescription); LoggerSubj.OnNext(err); + } + + public static void ErrorThrow(IException err) + { + Error(err); throw err.Exception; } diff --git a/Wabbajack.Lib/CompilationSteps/DeconstructBSAs.cs b/Wabbajack.Lib/CompilationSteps/DeconstructBSAs.cs index d1877a5f..2e00bc31 100644 --- a/Wabbajack.Lib/CompilationSteps/DeconstructBSAs.cs +++ b/Wabbajack.Lib/CompilationSteps/DeconstructBSAs.cs @@ -73,7 +73,7 @@ namespace Wabbajack.Lib.CompilationSteps foreach (var match in matches) { if (match is IgnoredDirectly) - Utils.Error(new UnconvertedError($"File required for BSA {source.Path} creation doesn't exist: {match.To}")); + Utils.ErrorThrow(new UnconvertedError($"File required for BSA {source.Path} creation doesn't exist: {match.To}")); _mo2Compiler.ExtraFiles.Add(match); } diff --git a/Wabbajack.Lib/Downloaders/NexusDownloader.cs b/Wabbajack.Lib/Downloaders/NexusDownloader.cs index b17d1ee5..6a754712 100644 --- a/Wabbajack.Lib/Downloaders/NexusDownloader.cs +++ b/Wabbajack.Lib/Downloaders/NexusDownloader.cs @@ -46,12 +46,12 @@ namespace Wabbajack.Lib.Downloaders var status = client.GetUserStatus(); if (!client.IsAuthenticated) { - Utils.Error(new UnconvertedError($"Authenticating for the Nexus failed. A nexus account is required to automatically download mods.")); + Utils.ErrorThrow(new UnconvertedError($"Authenticating for the Nexus failed. A nexus account is required to automatically download mods.")); return; } if (status.is_premium) return; - Utils.Error(new UnconvertedError($"Automated installs with Wabbajack requires a premium nexus account. {client.Username} is not a premium account.")); + Utils.ErrorThrow(new UnconvertedError($"Automated installs with Wabbajack requires a premium nexus account. {client.Username} is not a premium account.")); } public class State : AbstractDownloadState diff --git a/Wabbajack.Lib/MO2Installer.cs b/Wabbajack.Lib/MO2Installer.cs index 5c6f5dc2..26506228 100644 --- a/Wabbajack.Lib/MO2Installer.cs +++ b/Wabbajack.Lib/MO2Installer.cs @@ -140,7 +140,7 @@ namespace Wabbajack.Lib var hash = gameFile.FileHash(); if (hash != esm.SourceESMHash) { - Utils.Error(new InvalidGameESMError(esm, hash, gameFile)); + Utils.ErrorThrow(new InvalidGameESMError(esm, hash, gameFile)); } } }