Skip to content

Commit

Permalink
Fix exception throw (#28104)
Browse files Browse the repository at this point in the history
* fix exception throw

* fix settings crash

* throw runtime_error
  • Loading branch information
davidegiacometti committed Aug 24, 2023
1 parent 8314316 commit 738072f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions src/modules/MouseUtils/FindMyMouse/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ void FindMyMouse::parse_settings(PowerToysSettings::PowerToyValues& settings)
}
else
{
throw;
throw std::runtime_error("Invalid Activation Method value");
}

}
Expand Down Expand Up @@ -258,7 +258,7 @@ void FindMyMouse::parse_settings(PowerToysSettings::PowerToyValues& settings)
}
else
{
throw;
throw std::runtime_error("Invalid Overlay Opacity value");
}
}
catch (...)
Expand All @@ -276,7 +276,7 @@ void FindMyMouse::parse_settings(PowerToysSettings::PowerToyValues& settings)
}
else
{
throw;
throw std::runtime_error("Invalid Spotlight Radius value");
}
}
catch (...)
Expand All @@ -294,7 +294,7 @@ void FindMyMouse::parse_settings(PowerToysSettings::PowerToyValues& settings)
}
else
{
throw;
throw std::runtime_error("Invalid Animation Duration value");
}
}
catch (...)
Expand All @@ -312,7 +312,7 @@ void FindMyMouse::parse_settings(PowerToysSettings::PowerToyValues& settings)
}
else
{
throw;
throw std::runtime_error("Invalid Spotlight Initial Zoom value");
}
}
catch (...)
Expand Down Expand Up @@ -355,7 +355,7 @@ void FindMyMouse::parse_settings(PowerToysSettings::PowerToyValues& settings)
}
else
{
throw;
throw std::runtime_error("Invalid Shaking Minimum Distance value");
}
}
catch (...)
Expand Down
8 changes: 4 additions & 4 deletions src/modules/MouseUtils/MouseHighlighter/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class MouseHighlighter : public PowertoyModuleIface
}
else
{
throw;
throw std::runtime_error("Invalid Opacity value");
}
}
catch (...)
Expand Down Expand Up @@ -314,7 +314,7 @@ class MouseHighlighter : public PowertoyModuleIface
}
else
{
throw;
throw std::runtime_error("Invalid Radius value");
}
}
catch (...)
Expand All @@ -332,7 +332,7 @@ class MouseHighlighter : public PowertoyModuleIface
}
else
{
throw;
throw std::runtime_error("Invalid Fade Delay value");
}
}
catch (...)
Expand All @@ -350,7 +350,7 @@ class MouseHighlighter : public PowertoyModuleIface
}
else
{
throw;
throw std::runtime_error("Invalid Fade Duration value");
}
}
catch (...)
Expand Down
10 changes: 5 additions & 5 deletions src/modules/MouseUtils/MousePointerCrosshairs/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class MousePointerCrosshairs : public PowertoyModuleIface
}
else
{
throw;
throw std::runtime_error("Invalid Opacity value");
}
}
catch (...)
Expand Down Expand Up @@ -270,7 +270,7 @@ class MousePointerCrosshairs : public PowertoyModuleIface
}
else
{
throw;
throw std::runtime_error("Invalid Radius value");
}

}
Expand All @@ -289,7 +289,7 @@ class MousePointerCrosshairs : public PowertoyModuleIface
}
else
{
throw;
throw std::runtime_error("Invalid Thickness value");
}

}
Expand Down Expand Up @@ -327,7 +327,7 @@ class MousePointerCrosshairs : public PowertoyModuleIface
}
else
{
throw;
throw std::runtime_error("Invalid Border Color value");
}
}
catch (...)
Expand Down Expand Up @@ -366,7 +366,7 @@ class MousePointerCrosshairs : public PowertoyModuleIface
}
else
{
throw;
throw std::runtime_error("Invalid Fixed Length value");
}
}
catch (...)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ class ShortcutGuideModule : public PowertoyModuleIface
}
else
{
throw;
throw std::runtime_error("Invalid Press Time Windows Shortcuts value");
}
value = static_cast<int>(jsonPressTimeForTaskbarIconShortcutsObject.GetNamedNumber(L"value"));
if (value >= 0)
Expand All @@ -351,7 +351,7 @@ class ShortcutGuideModule : public PowertoyModuleIface
}
else
{
throw;
throw std::runtime_error("Invalid Press Time Taskbar Shortcuts value");
}
}
catch (...)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public MouseUtilsViewModel(ISettingsUtils settingsUtils, ISettingsRepository<Gen
}

FindMyMouseSettingsConfig = findMyMouseSettingsRepository.SettingsConfig;
_findMyMouseActivationMethod = FindMyMouseSettingsConfig.Properties.ActivationMethod.Value;
_findMyMouseActivationMethod = FindMyMouseSettingsConfig.Properties.ActivationMethod.Value < 2 ? FindMyMouseSettingsConfig.Properties.ActivationMethod.Value : 0;
_findMyMouseDoNotActivateOnGameMode = FindMyMouseSettingsConfig.Properties.DoNotActivateOnGameMode.Value;

string backgroundColor = FindMyMouseSettingsConfig.Properties.BackgroundColor.Value;
Expand Down

0 comments on commit 738072f

Please sign in to comment.