mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
Catch std::exception by reference (#20385)
This commit is contained in:
@@ -102,7 +102,7 @@ namespace package {
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (std::exception e)
|
||||
catch (std::exception& e)
|
||||
{
|
||||
Logger::error("Exception thrown while trying to register package: {}", e.what());
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ private:
|
||||
|
||||
parse_hotkey(settings);
|
||||
}
|
||||
catch (std::exception ex)
|
||||
catch (std::exception&)
|
||||
{
|
||||
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.
|
||||
@@ -208,7 +208,7 @@ public:
|
||||
// Otherwise call a custom function to process the settings before saving them to disk:
|
||||
// save_settings();
|
||||
}
|
||||
catch (std::exception ex)
|
||||
catch (std::exception&)
|
||||
{
|
||||
// Improper JSON.
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ private:
|
||||
|
||||
parse_hotkey(settings);
|
||||
}
|
||||
catch (std::exception ex)
|
||||
catch (std::exception&)
|
||||
{
|
||||
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.
|
||||
@@ -220,7 +220,7 @@ public:
|
||||
// Otherwise call a custom function to process the settings before saving them to disk:
|
||||
// save_settings();
|
||||
}
|
||||
catch (std::exception ex)
|
||||
catch (std::exception&)
|
||||
{
|
||||
// Improper JSON.
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
|
||||
ParseSettings(values);
|
||||
}
|
||||
catch (std::exception ex)
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
Logger::error("Failed to parse settings. {}", ex.what());
|
||||
}
|
||||
@@ -261,7 +261,7 @@ private:
|
||||
|
||||
ParseSettings(settings);
|
||||
}
|
||||
catch (std::exception ex)
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
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:
|
||||
// save_settings();
|
||||
}
|
||||
catch (std::exception ex)
|
||||
catch (std::exception&)
|
||||
{
|
||||
// Improper JSON.
|
||||
}
|
||||
@@ -273,7 +273,7 @@ private:
|
||||
|
||||
parse_hotkey(settings);
|
||||
}
|
||||
catch (std::exception ex)
|
||||
catch (std::exception&)
|
||||
{
|
||||
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.
|
||||
|
||||
@@ -144,7 +144,7 @@ private:
|
||||
|
||||
parse_hotkey(settings);
|
||||
}
|
||||
catch (std::exception ex)
|
||||
catch (std::exception&)
|
||||
{
|
||||
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.
|
||||
@@ -221,7 +221,7 @@ public:
|
||||
// Otherwise call a custom function to process the settings before saving them to disk:
|
||||
// save_settings();
|
||||
}
|
||||
catch (std::exception ex)
|
||||
catch (std::exception&)
|
||||
{
|
||||
// Improper JSON.
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ public:
|
||||
PowerToysSettings::CustomActionObject action_object =
|
||||
PowerToysSettings::CustomActionObject::from_json_string(action);
|
||||
}
|
||||
catch (std::exception ex)
|
||||
catch (std::exception&)
|
||||
{
|
||||
// Improper JSON.
|
||||
}
|
||||
@@ -198,7 +198,7 @@ public:
|
||||
// Otherwise call a custom function to process the settings before saving them to disk:
|
||||
// save_settings();
|
||||
}
|
||||
catch (std::exception ex)
|
||||
catch (std::exception&)
|
||||
{
|
||||
// Improper JSON.
|
||||
}
|
||||
@@ -366,7 +366,7 @@ void Microsoft_Launcher::init_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.
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace winrt::PowerRenameUI::implementation
|
||||
SetHandlers();
|
||||
ReadSettings();
|
||||
}
|
||||
catch (std::exception e)
|
||||
catch (std::exception& e)
|
||||
{
|
||||
Logger::error("Exception thrown during explorer items population: {}", std::string{ e.what() });
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ public:
|
||||
|
||||
Trace::SettingsChanged();
|
||||
}
|
||||
catch (std::exception e)
|
||||
catch (std::exception& e)
|
||||
{
|
||||
Logger::error("Configuration parsing failed: {}", std::string{ e.what() });
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace CentralizedHotkeys
|
||||
{
|
||||
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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user