mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 12:18:50 +02:00
[PTRun]Improve copying error handling on plugins (#35459)
This commit is contained in:
@@ -14,6 +14,7 @@ using System.Windows.Input;
|
||||
|
||||
using ManagedCommon;
|
||||
using Wox.Plugin;
|
||||
using Wox.Plugin.Logger;
|
||||
|
||||
namespace Community.PowerToys.Run.Plugin.UnitConverter
|
||||
{
|
||||
@@ -75,9 +76,10 @@ namespace Community.PowerToys.Run.Plugin.UnitConverter
|
||||
Clipboard.SetText(result.ConvertedValue.ToString(UnitConversionResult.CopyFormat, CultureInfo.CurrentCulture));
|
||||
ret = true;
|
||||
}
|
||||
catch (ExternalException)
|
||||
catch (ExternalException ex)
|
||||
{
|
||||
MessageBox.Show(Properties.Resources.copy_failed);
|
||||
Log.Exception("Copy failed", ex, GetType());
|
||||
MessageBox.Show(ex.Message, Properties.Resources.copy_failed);
|
||||
}
|
||||
});
|
||||
thread.SetApartmentState(ApartmentState.STA);
|
||||
@@ -107,9 +109,10 @@ namespace Community.PowerToys.Run.Plugin.UnitConverter
|
||||
Clipboard.SetText(result.ConvertedValue.ToString(UnitConversionResult.CopyFormat, CultureInfo.CurrentCulture));
|
||||
ret = true;
|
||||
}
|
||||
catch (ExternalException)
|
||||
catch (ExternalException ex)
|
||||
{
|
||||
MessageBox.Show(Properties.Resources.copy_failed);
|
||||
Log.Exception("Copy failed", ex, GetType());
|
||||
MessageBox.Show(ex.Message, Properties.Resources.copy_failed);
|
||||
}
|
||||
});
|
||||
thread.SetApartmentState(ApartmentState.STA);
|
||||
|
||||
Reference in New Issue
Block a user