Consolidate some of the throws

This commit is contained in:
Matt Nadareski
2020-09-15 17:09:35 -07:00
parent 74a0c47102
commit 044d70da6e
16 changed files with 58 additions and 175 deletions

View File

@@ -127,9 +127,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
return false;
}
@@ -208,9 +205,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
return realentry;
}
@@ -250,9 +244,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
return (ms, realentry);
}
@@ -390,9 +381,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
success = false;
}
finally

View File

@@ -78,22 +78,16 @@ namespace SabreTools.Library.FileTypes
catch (EndOfStreamException ex)
{
// Catch this but don't count it as an error because SharpCompress is unsafe
if (Globals.ThrowOnError)
throw ex;
Globals.Logger.Verbose(ex);
}
catch (InvalidOperationException ex)
{
if (Globals.ThrowOnError)
throw ex;
Globals.Logger.Warning(ex);
encounteredErrors = true;
}
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
encounteredErrors = true;
}
@@ -181,9 +175,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
ms = null;
realEntry = null;
}
@@ -253,9 +244,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
return null;
}
}

View File

@@ -71,22 +71,16 @@ namespace SabreTools.Library.FileTypes
catch (EndOfStreamException ex)
{
// Catch this but don't count it as an error because SharpCompress is unsafe
if (Globals.ThrowOnError)
throw ex;
Globals.Logger.Verbose(ex);
}
catch (InvalidOperationException ex)
{
if (Globals.ThrowOnError)
throw ex;
Globals.Logger.Warning(ex);
encounteredErrors = true;
}
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
encounteredErrors = true;
}
@@ -167,9 +161,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
ms = null;
realEntry = null;
}
@@ -230,9 +221,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
return null;
}
@@ -274,8 +262,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
}
return empties;

View File

@@ -120,22 +120,16 @@ namespace SabreTools.Library.FileTypes
catch (EndOfStreamException ex)
{
// Catch this but don't count it as an error because SharpCompress is unsafe
if (Globals.ThrowOnError)
throw ex;
Globals.Logger.Verbose(ex);
}
catch (InvalidOperationException ex)
{
if (Globals.ThrowOnError)
throw ex;
Globals.Logger.Warning(ex);
encounteredErrors = true;
}
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
encounteredErrors = true;
}
@@ -251,9 +245,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
ms = null;
realEntry = null;
}
@@ -341,9 +332,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
return null;
}
@@ -397,8 +385,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
}
return empties;
@@ -616,9 +602,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
success = false;
}
finally
@@ -848,9 +831,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
success = false;
}

View File

@@ -76,23 +76,16 @@ namespace SabreTools.Library.FileTypes
catch (EndOfStreamException ex)
{
// Catch this but don't count it as an error because SharpCompress is unsafe
if (Globals.ThrowOnError)
throw ex;
Globals.Logger.Verbose(ex);
}
catch (InvalidOperationException ex)
{
if (Globals.ThrowOnError)
throw ex;
Globals.Logger.Warning(ex);
encounteredErrors = true;
}
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
encounteredErrors = true;
}
@@ -173,9 +166,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
ms = null;
realEntry = null;
}
@@ -236,9 +226,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
return null;
}
@@ -280,8 +267,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
}
return empties;
@@ -436,9 +421,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
success = false;
}
finally
@@ -619,9 +601,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
success = false;
}
finally

View File

@@ -72,22 +72,16 @@ namespace SabreTools.Library.FileTypes
catch (EndOfStreamException ex)
{
// Catch this but don't count it as an error because SharpCompress is unsafe
if (Globals.ThrowOnError)
throw ex;
Globals.Logger.Verbose(ex);
}
catch (InvalidOperationException ex)
{
if (Globals.ThrowOnError)
throw ex;
Globals.Logger.Warning(ex);
encounteredErrors = true;
}
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
encounteredErrors = true;
}
@@ -173,9 +167,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
ms = null;
realEntry = null;
}
@@ -242,9 +233,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
return null;
}
}

View File

@@ -121,22 +121,16 @@ namespace SabreTools.Library.FileTypes
catch (EndOfStreamException ex)
{
// Catch this but don't count it as an error because SharpCompress is unsafe
if (Globals.ThrowOnError)
throw ex;
Globals.Logger.Verbose(ex);
}
catch (InvalidOperationException ex)
{
if (Globals.ThrowOnError)
throw ex;
Globals.Logger.Warning(ex);
encounteredErrors = true;
}
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
encounteredErrors = true;
}
@@ -252,9 +246,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
ms = null;
realEntry = null;
}
@@ -346,9 +337,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
return null;
}
@@ -402,8 +390,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
}
return empties;
@@ -620,9 +606,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
success = false;
}
finally
@@ -853,9 +836,6 @@ namespace SabreTools.Library.FileTypes
catch (Exception ex)
{
Globals.Logger.Error(ex);
if (Globals.ThrowOnError)
throw ex;
success = false;
}