mirror of
https://github.com/microsoft/PowerToys
synced 2025-08-22 10:07:37 +00:00
Catch std::exception by reference (#20385)
This commit is contained in:
parent
675d79a4aa
commit
922d21f9f1
@ -982,7 +982,7 @@ UINT __stdcall UnRegisterContextMenuPackagesCA(MSIHANDLE hInstall)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (std::exception e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
std::string errorMessage{ "Exception thrown while trying to unregister sparse packages: " };
|
std::string errorMessage{ "Exception thrown while trying to unregister sparse packages: " };
|
||||||
errorMessage += e.what();
|
errorMessage += e.what();
|
||||||
|
@ -102,7 +102,7 @@ namespace package {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (std::exception e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
Logger::error("Exception thrown while trying to register package: {}", e.what());
|
Logger::error("Exception thrown while trying to register package: {}", e.what());
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ private:
|
|||||||
|
|
||||||
parse_hotkey(settings);
|
parse_hotkey(settings);
|
||||||
}
|
}
|
||||||
catch (std::exception ex)
|
catch (std::exception&)
|
||||||
{
|
{
|
||||||
Logger::warn(L"An exception occurred while loading the settings file");
|
Logger::warn(L"An exception occurred while loading the settings file");
|
||||||
// Error while loading from the settings file. Let default values stay as they are.
|
// Error while loading from the settings file. Let default values stay as they are.
|
||||||
@ -208,7 +208,7 @@ public:
|
|||||||
// Otherwise call a custom function to process the settings before saving them to disk:
|
// Otherwise call a custom function to process the settings before saving them to disk:
|
||||||
// save_settings();
|
// save_settings();
|
||||||
}
|
}
|
||||||
catch (std::exception ex)
|
catch (std::exception&)
|
||||||
{
|
{
|
||||||
// Improper JSON.
|
// Improper JSON.
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ private:
|
|||||||
|
|
||||||
parse_hotkey(settings);
|
parse_hotkey(settings);
|
||||||
}
|
}
|
||||||
catch (std::exception ex)
|
catch (std::exception&)
|
||||||
{
|
{
|
||||||
Logger::warn(L"An exception occurred while loading the settings file");
|
Logger::warn(L"An exception occurred while loading the settings file");
|
||||||
// Error while loading from the settings file. Let default values stay as they are.
|
// Error while loading from the settings file. Let default values stay as they are.
|
||||||
@ -220,7 +220,7 @@ public:
|
|||||||
// Otherwise call a custom function to process the settings before saving them to disk:
|
// Otherwise call a custom function to process the settings before saving them to disk:
|
||||||
// save_settings();
|
// save_settings();
|
||||||
}
|
}
|
||||||
catch (std::exception ex)
|
catch (std::exception&)
|
||||||
{
|
{
|
||||||
// Improper JSON.
|
// Improper JSON.
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ public:
|
|||||||
|
|
||||||
ParseSettings(values);
|
ParseSettings(values);
|
||||||
}
|
}
|
||||||
catch (std::exception ex)
|
catch (std::exception& ex)
|
||||||
{
|
{
|
||||||
Logger::error("Failed to parse settings. {}", ex.what());
|
Logger::error("Failed to parse settings. {}", ex.what());
|
||||||
}
|
}
|
||||||
@ -261,7 +261,7 @@ private:
|
|||||||
|
|
||||||
ParseSettings(settings);
|
ParseSettings(settings);
|
||||||
}
|
}
|
||||||
catch (std::exception ex)
|
catch (std::exception& ex)
|
||||||
{
|
{
|
||||||
Logger::error("Failed to init settings. {}", ex.what());
|
Logger::error("Failed to init settings. {}", ex.what());
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ public:
|
|||||||
// Otherwise call a custom function to process the settings before saving them to disk:
|
// Otherwise call a custom function to process the settings before saving them to disk:
|
||||||
// save_settings();
|
// save_settings();
|
||||||
}
|
}
|
||||||
catch (std::exception ex)
|
catch (std::exception&)
|
||||||
{
|
{
|
||||||
// Improper JSON.
|
// Improper JSON.
|
||||||
}
|
}
|
||||||
@ -273,7 +273,7 @@ private:
|
|||||||
|
|
||||||
parse_hotkey(settings);
|
parse_hotkey(settings);
|
||||||
}
|
}
|
||||||
catch (std::exception ex)
|
catch (std::exception&)
|
||||||
{
|
{
|
||||||
Logger::warn(L"An exception occurred while loading the settings file");
|
Logger::warn(L"An exception occurred while loading the settings file");
|
||||||
// Error while loading from the settings file. Let default values stay as they are.
|
// Error while loading from the settings file. Let default values stay as they are.
|
||||||
|
@ -144,7 +144,7 @@ private:
|
|||||||
|
|
||||||
parse_hotkey(settings);
|
parse_hotkey(settings);
|
||||||
}
|
}
|
||||||
catch (std::exception ex)
|
catch (std::exception&)
|
||||||
{
|
{
|
||||||
Logger::warn(L"An exception occurred while loading the settings file");
|
Logger::warn(L"An exception occurred while loading the settings file");
|
||||||
// Error while loading from the settings file. Let default values stay as they are.
|
// Error while loading from the settings file. Let default values stay as they are.
|
||||||
@ -221,7 +221,7 @@ public:
|
|||||||
// Otherwise call a custom function to process the settings before saving them to disk:
|
// Otherwise call a custom function to process the settings before saving them to disk:
|
||||||
// save_settings();
|
// save_settings();
|
||||||
}
|
}
|
||||||
catch (std::exception ex)
|
catch (std::exception&)
|
||||||
{
|
{
|
||||||
// Improper JSON.
|
// Improper JSON.
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ public:
|
|||||||
PowerToysSettings::CustomActionObject action_object =
|
PowerToysSettings::CustomActionObject action_object =
|
||||||
PowerToysSettings::CustomActionObject::from_json_string(action);
|
PowerToysSettings::CustomActionObject::from_json_string(action);
|
||||||
}
|
}
|
||||||
catch (std::exception ex)
|
catch (std::exception&)
|
||||||
{
|
{
|
||||||
// Improper JSON.
|
// Improper JSON.
|
||||||
}
|
}
|
||||||
@ -198,7 +198,7 @@ public:
|
|||||||
// Otherwise call a custom function to process the settings before saving them to disk:
|
// Otherwise call a custom function to process the settings before saving them to disk:
|
||||||
// save_settings();
|
// save_settings();
|
||||||
}
|
}
|
||||||
catch (std::exception ex)
|
catch (std::exception&)
|
||||||
{
|
{
|
||||||
// Improper JSON.
|
// Improper JSON.
|
||||||
}
|
}
|
||||||
@ -366,7 +366,7 @@ void Microsoft_Launcher::init_settings()
|
|||||||
|
|
||||||
parse_hotkey(settings);
|
parse_hotkey(settings);
|
||||||
}
|
}
|
||||||
catch (std::exception ex)
|
catch (std::exception&)
|
||||||
{
|
{
|
||||||
// Error while loading from the settings file. Let default values stay as they are.
|
// Error while loading from the settings file. Let default values stay as they are.
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ namespace winrt::PowerRenameUI::implementation
|
|||||||
SetHandlers();
|
SetHandlers();
|
||||||
ReadSettings();
|
ReadSettings();
|
||||||
}
|
}
|
||||||
catch (std::exception e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
Logger::error("Exception thrown during explorer items population: {}", std::string{ e.what() });
|
Logger::error("Exception thrown during explorer items population: {}", std::string{ e.what() });
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ public:
|
|||||||
|
|
||||||
Trace::SettingsChanged();
|
Trace::SettingsChanged();
|
||||||
}
|
}
|
||||||
catch (std::exception e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
Logger::error("Configuration parsing failed: {}", std::string{ e.what() });
|
Logger::error("Configuration parsing failed: {}", std::string{ e.what() });
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ namespace CentralizedHotkeys
|
|||||||
{
|
{
|
||||||
actions[shortcut].begin()->action(shortcut.modifiersMask, shortcut.vkCode);
|
actions[shortcut].begin()->action(shortcut.modifiersMask, shortcut.vkCode);
|
||||||
}
|
}
|
||||||
catch(std::exception ex)
|
catch(std::exception& ex)
|
||||||
{
|
{
|
||||||
Logger::error("Failed to execute hotkey's action. {}", ex.what());
|
Logger::error("Failed to execute hotkey's action. {}", ex.what());
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ void $safeprojectname$::init_settings()
|
|||||||
// // Save the PowerToyValues JSON to the power toy settings file.
|
// // Save the PowerToyValues JSON to the power toy settings file.
|
||||||
// values.save_to_settings_file();
|
// values.save_to_settings_file();
|
||||||
// }
|
// }
|
||||||
// catch (std::exception ex) {
|
// catch (std::exception& ex) {
|
||||||
// // Couldn't save the settings.
|
// // Couldn't save the settings.
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
@ -147,7 +147,7 @@ Here's an example settings implementation:
|
|||||||
// Otherwise call a custom function to process the settings before saving them to disk:
|
// Otherwise call a custom function to process the settings before saving them to disk:
|
||||||
// save_settings();
|
// save_settings();
|
||||||
}
|
}
|
||||||
catch (std::exception ex) {
|
catch (std::exception& ex) {
|
||||||
// Improper JSON.
|
// Improper JSON.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -325,7 +325,7 @@ When the custom action button is pressed, the PowerToy's `call_custom_action()`
|
|||||||
MessageBox(NULL, msg.c_str(), L"Custom action call.", MB_OK | MB_TOPMOST);
|
MessageBox(NULL, msg.c_str(), L"Custom action call.", MB_OK | MB_TOPMOST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (std::exception ex) {
|
catch (std::exception& ex) {
|
||||||
// Improper JSON.
|
// Improper JSON.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -371,7 +371,7 @@ void ExamplePowertoy::init_settings() {
|
|||||||
g_settings.test_color_prop = settings.get_string_value(L"test_color_picker");
|
g_settings.test_color_prop = settings.get_string_value(L"test_color_picker");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (std::exception ex) {
|
catch (std::exception& ex) {
|
||||||
// Error while loading from the settings file. Let default values stay as they are.
|
// Error while loading from the settings file. Let default values stay as they are.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -392,7 +392,7 @@ virtual void set_config(const wchar_t* config) override {
|
|||||||
...
|
...
|
||||||
values.save_to_settings_file();
|
values.save_to_settings_file();
|
||||||
}
|
}
|
||||||
catch (std::exception ex) {
|
catch (std::exception& ex) {
|
||||||
// Improper JSON.
|
// Improper JSON.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -434,7 +434,7 @@ void ExamplePowertoy::save_settings() {
|
|||||||
// Save the PowerToyValues JSON to the power toy settings file.
|
// Save the PowerToyValues JSON to the power toy settings file.
|
||||||
values.save_to_settings_file();
|
values.save_to_settings_file();
|
||||||
}
|
}
|
||||||
catch (std::exception ex) {
|
catch (std::exception& ex) {
|
||||||
// Couldn't save the settings.
|
// Couldn't save the settings.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user