From 8053a3d59a977243f68f70141c739c532838729e Mon Sep 17 00:00:00 2001 From: Jorixon <143650598+Jorixon@users.noreply.github.com> Date: Sun, 10 Nov 2024 15:33:11 +0100 Subject: [PATCH] Catch all ComException --- .../CharacterDetailsPages/CharacterDetailsPage.xaml.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/GIMI-ModManager.WinUI/Views/CharacterDetailsPages/CharacterDetailsPage.xaml.cs b/src/GIMI-ModManager.WinUI/Views/CharacterDetailsPages/CharacterDetailsPage.xaml.cs index 7c14737..473247c 100644 --- a/src/GIMI-ModManager.WinUI/Views/CharacterDetailsPages/CharacterDetailsPage.xaml.cs +++ b/src/GIMI-ModManager.WinUI/Views/CharacterDetailsPages/CharacterDetailsPage.xaml.cs @@ -12,6 +12,7 @@ using Microsoft.UI.Xaml.Input; using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Navigation; +using Serilog; namespace GIMI_ModManager.WinUI.Views.CharacterDetailsPages; @@ -237,12 +238,18 @@ private async void ModListArea_OnDragEnter(object sender, DragEventArgs e) if (ViewModel.CanDragDropMod(storageItems)) e.AcceptedOperation = DataPackageOperation.Copy; } - catch (COMException exception) when (exception.HResult == -2147221404) + catch (COMException exception) { // When drag and dropping a folder from within an archive in WinRAR, GetStorageItemsAsync throws a COMException // For this case, assume this is a valid drag and drop operation as the command itself will also check if the items are valid + // when (exception.HResult == -2147221404) HResult that is thrown specifically for WinRAR e.AcceptedOperation = DataPackageOperation.Copy; + + if (exception.HResult != -2147221404) + { + Log.Error(exception, "Error while checking if the dragged items are valid."); + } } } }