mirror of
https://github.com/QL-Win/QuickLook.git
synced 2026-03-21 01:08:08 +08:00
Specify exception types in catch blocks for better error handling
Co-authored-by: emako <24737061+emako@users.noreply.github.com>
This commit is contained in:
@@ -25,6 +25,7 @@ using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Security;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
@@ -134,7 +135,8 @@ public partial class App : Application
|
||||
if (Directory.Exists(path) || File.Exists(path))
|
||||
PipeServerManager.SendMessage(PipeMessages.Toggle, path);
|
||||
}
|
||||
catch
|
||||
catch (Exception ex) when (ex is ArgumentException || ex is SecurityException ||
|
||||
ex is NotSupportedException || ex is PathTooLongException)
|
||||
{
|
||||
// Invalid path, ignore
|
||||
}
|
||||
@@ -312,7 +314,8 @@ public partial class App : Application
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex) when (ex is ArgumentException || ex is SecurityException ||
|
||||
ex is NotSupportedException || ex is PathTooLongException)
|
||||
{
|
||||
// Invalid path, continue to show duplicate message
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user