Add and use ThrowOnError global (temp)

This commit is contained in:
Matt Nadareski
2020-09-15 12:12:13 -07:00
parent ab06bf89f6
commit 91f659dca2
34 changed files with 468 additions and 30 deletions

View File

@@ -118,17 +118,25 @@ namespace SabreTools.Library.FileTypes
zf.ZipFileClose();
encounteredErrors = false;
}
catch (EndOfStreamException)
catch (EndOfStreamException ex)
{
// Catch this but don't count it as an error because SharpCompress is unsafe
if (Globals.ThrowOnError)
throw ex;
}
catch (InvalidOperationException)
catch (InvalidOperationException ex)
{
if (Globals.ThrowOnError)
throw ex;
encounteredErrors = true;
}
catch (Exception ex)
{
Globals.Logger.Error(ex.ToString());
if (Globals.ThrowOnError)
throw ex;
encounteredErrors = true;
}
@@ -244,6 +252,9 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex.ToString());
if (Globals.ThrowOnError)
throw ex;
ms = null;
realEntry = null;
}
@@ -335,6 +346,9 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex.ToString());
if (Globals.ThrowOnError)
throw ex;
return null;
}
@@ -388,6 +402,8 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex.ToString());
if (Globals.ThrowOnError)
throw ex;
}
return empties;
@@ -603,7 +619,10 @@ namespace SabreTools.Library.FileTypes
}
catch (Exception ex)
{
Console.WriteLine(ex);
Globals.Logger.Error(ex.ToString());
if (Globals.ThrowOnError)
throw ex;
success = false;
}
finally
@@ -833,7 +852,10 @@ namespace SabreTools.Library.FileTypes
}
catch (Exception ex)
{
Console.WriteLine(ex);
Globals.Logger.Error(ex.ToString());
if (Globals.ThrowOnError)
throw ex;
success = false;
}