Utils.ErrorThrow added for when wanting to throw the exception

This commit is contained in:
Justin Swanson 2019-12-04 22:58:02 -06:00
parent 2c47f54752
commit bf87746e69
4 changed files with 9 additions and 4 deletions

View File

@ -72,6 +72,11 @@ namespace Wabbajack.Common
{
LogToFile(err.ShortDescription);
LoggerSubj.OnNext(err);
}
public static void ErrorThrow(IException err)
{
Error(err);
throw err.Exception;
}

View File

@ -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);
}

View File

@ -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

View File

@ -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));
}
}
}