[BUG] Fix ArgumentException DirectoryNotFoundException (#198), version 1.0.19.1

This commit is contained in:
Markus Hofknecht 2021-09-29 22:21:02 +02:00
parent e921e1dc7e
commit bec9212d1b
6 changed files with 16 additions and 90 deletions

View file

@ -357,7 +357,7 @@ namespace SystemTrayMenu.Business
Log.Warn($"path:'{path}'", ex);
menuData.Validity = MenuDataValidity.NoAccess;
}
catch (IOException ex)
catch (Exception ex)
{
Log.Warn($"path:'{path}'", ex);
}
@ -410,7 +410,7 @@ namespace SystemTrayMenu.Business
Log.Warn($"path:'{path}'", ex);
menuData.Validity = MenuDataValidity.NoAccess;
}
catch (IOException ex)
catch (Exception ex)
{
Log.Warn($"path:'{path}'", ex);
}
@ -594,18 +594,7 @@ namespace SystemTrayMenu.Business
}
catch (Exception ex)
{
if (ex is SecurityException ||
ex is ArgumentException ||
ex is UnauthorizedAccessException ||
ex is PathTooLongException ||
ex is NotSupportedException)
{
Log.Warn($"fileName:'{fileName}'", ex);
}
else
{
throw;
}
Log.Warn($"fileName:'{fileName}'", ex);
}
return rowData;

View file

@ -118,11 +118,7 @@ namespace SystemTrayMenu
{
folderContainsFiles = Directory.GetFiles(path).Length > 0;
}
catch (UnauthorizedAccessException ex)
{
Log.Warn($"path:'{path}'", ex);
}
catch (IOException ex)
catch (Exception ex)
{
Log.Warn($"path:'{path}'", ex);
}

View file

@ -156,18 +156,7 @@ namespace SystemTrayMenu.DataClasses
}
catch (Exception ex)
{
if (ex is SecurityException ||
ex is ArgumentException ||
ex is UnauthorizedAccessException ||
ex is PathTooLongException ||
ex is NotSupportedException)
{
Log.Warn($"path:'{TargetFilePath}'", ex);
}
else
{
throw;
}
Log.Warn($"path:'{TargetFilePath}'", ex);
}
}
}
@ -388,21 +377,10 @@ namespace SystemTrayMenu.DataClasses
}
catch (Exception ex)
{
if (ex is SecurityException ||
ex is ArgumentException ||
ex is UnauthorizedAccessException ||
ex is PathTooLongException ||
ex is NotSupportedException)
{
Log.Warn(
$"path:'{TargetFilePath}', " +
$"iconFile:'{iconFile}'",
ex);
}
else
{
throw;
}
Log.Warn(
$"path:'{TargetFilePath}', " +
$"iconFile:'{iconFile}'",
ex);
}
SetText($"{FileInfo.Name[0..^4]}");
@ -427,21 +405,10 @@ namespace SystemTrayMenu.DataClasses
}
catch (Exception ex)
{
if (ex is SecurityException ||
ex is ArgumentException ||
ex is UnauthorizedAccessException ||
ex is PathTooLongException ||
ex is NotSupportedException)
{
Log.Warn(
$"path:'{TargetFilePath}', " +
$"executable:'{executable}'",
ex);
}
else
{
throw;
}
Log.Warn(
$"path:'{TargetFilePath}', " +
$"executable:'{executable}'",
ex);
}
return handled;

View file

@ -411,16 +411,7 @@ namespace SystemTrayMenu.UserInterface
}
catch (Exception ex)
{
if (ex is SecurityException ||
ex is UnauthorizedAccessException ||
ex is IOException)
{
Log.Warn($"KeyName:'{keyName}' SubKeyRef:'{subKeyRef}'", ex);
}
else
{
throw;
}
Log.Warn($"KeyName:'{keyName}' SubKeyRef:'{subKeyRef}'", ex);
}
return strSysInfoPath;

View file

@ -115,15 +115,7 @@ namespace SystemTrayMenu.Utilities
}
catch (Exception ex)
{
if (ex is COMException ||
ex is UnauthorizedAccessException)
{
Log.Warn($"shortcutFilename:'{shortcutFilename}'", ex);
}
else
{
throw;
}
Log.Warn($"shortcutFilename:'{shortcutFilename}'", ex);
}
}

View file

@ -76,16 +76,7 @@ namespace SystemTrayMenu.Utilities
}
catch (Exception ex)
{
if (ex is UnauthorizedAccessException ||
ex is IOException ||
ex is ArgumentException)
{
Log.Warn($"path:'{path}'", ex);
}
else
{
throw;
}
Log.Warn($"path:'{path}'", ex);
}
}
else