Fix exception throw (#28104)

* fix exception throw

* fix settings crash

* throw runtime_error
This commit is contained in:
Davide Giacometti
2023-08-24 14:53:48 +02:00
committed by GitHub
parent 83143169c6
commit 738072f508
5 changed files with 18 additions and 18 deletions

View File

@@ -192,7 +192,7 @@ void FindMyMouse::parse_settings(PowerToysSettings::PowerToyValues& settings)
} }
else else
{ {
throw; throw std::runtime_error("Invalid Activation Method value");
} }
} }
@@ -258,7 +258,7 @@ void FindMyMouse::parse_settings(PowerToysSettings::PowerToyValues& settings)
} }
else else
{ {
throw; throw std::runtime_error("Invalid Overlay Opacity value");
} }
} }
catch (...) catch (...)
@@ -276,7 +276,7 @@ void FindMyMouse::parse_settings(PowerToysSettings::PowerToyValues& settings)
} }
else else
{ {
throw; throw std::runtime_error("Invalid Spotlight Radius value");
} }
} }
catch (...) catch (...)
@@ -294,7 +294,7 @@ void FindMyMouse::parse_settings(PowerToysSettings::PowerToyValues& settings)
} }
else else
{ {
throw; throw std::runtime_error("Invalid Animation Duration value");
} }
} }
catch (...) catch (...)
@@ -312,7 +312,7 @@ void FindMyMouse::parse_settings(PowerToysSettings::PowerToyValues& settings)
} }
else else
{ {
throw; throw std::runtime_error("Invalid Spotlight Initial Zoom value");
} }
} }
catch (...) catch (...)
@@ -355,7 +355,7 @@ void FindMyMouse::parse_settings(PowerToysSettings::PowerToyValues& settings)
} }
else else
{ {
throw; throw std::runtime_error("Invalid Shaking Minimum Distance value");
} }
} }
catch (...) catch (...)

View File

@@ -238,7 +238,7 @@ public:
} }
else else
{ {
throw; throw std::runtime_error("Invalid Opacity value");
} }
} }
catch (...) catch (...)
@@ -314,7 +314,7 @@ public:
} }
else else
{ {
throw; throw std::runtime_error("Invalid Radius value");
} }
} }
catch (...) catch (...)
@@ -332,7 +332,7 @@ public:
} }
else else
{ {
throw; throw std::runtime_error("Invalid Fade Delay value");
} }
} }
catch (...) catch (...)
@@ -350,7 +350,7 @@ public:
} }
else else
{ {
throw; throw std::runtime_error("Invalid Fade Duration value");
} }
} }
catch (...) catch (...)

View File

@@ -233,7 +233,7 @@ public:
} }
else else
{ {
throw; throw std::runtime_error("Invalid Opacity value");
} }
} }
catch (...) catch (...)
@@ -270,7 +270,7 @@ public:
} }
else else
{ {
throw; throw std::runtime_error("Invalid Radius value");
} }
} }
@@ -289,7 +289,7 @@ public:
} }
else else
{ {
throw; throw std::runtime_error("Invalid Thickness value");
} }
} }
@@ -327,7 +327,7 @@ public:
} }
else else
{ {
throw; throw std::runtime_error("Invalid Border Color value");
} }
} }
catch (...) catch (...)
@@ -366,7 +366,7 @@ public:
} }
else else
{ {
throw; throw std::runtime_error("Invalid Fixed Length value");
} }
} }
catch (...) catch (...)

View File

@@ -342,7 +342,7 @@ private:
} }
else else
{ {
throw; throw std::runtime_error("Invalid Press Time Windows Shortcuts value");
} }
value = static_cast<int>(jsonPressTimeForTaskbarIconShortcutsObject.GetNamedNumber(L"value")); value = static_cast<int>(jsonPressTimeForTaskbarIconShortcutsObject.GetNamedNumber(L"value"));
if (value >= 0) if (value >= 0)
@@ -351,7 +351,7 @@ private:
} }
else else
{ {
throw; throw std::runtime_error("Invalid Press Time Taskbar Shortcuts value");
} }
} }
catch (...) catch (...)

View File

@@ -48,7 +48,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
} }
FindMyMouseSettingsConfig = findMyMouseSettingsRepository.SettingsConfig; FindMyMouseSettingsConfig = findMyMouseSettingsRepository.SettingsConfig;
_findMyMouseActivationMethod = FindMyMouseSettingsConfig.Properties.ActivationMethod.Value; _findMyMouseActivationMethod = FindMyMouseSettingsConfig.Properties.ActivationMethod.Value < 2 ? FindMyMouseSettingsConfig.Properties.ActivationMethod.Value : 0;
_findMyMouseDoNotActivateOnGameMode = FindMyMouseSettingsConfig.Properties.DoNotActivateOnGameMode.Value; _findMyMouseDoNotActivateOnGameMode = FindMyMouseSettingsConfig.Properties.DoNotActivateOnGameMode.Value;
string backgroundColor = FindMyMouseSettingsConfig.Properties.BackgroundColor.Value; string backgroundColor = FindMyMouseSettingsConfig.Properties.BackgroundColor.Value;