Compare commits

...

3 Commits

2 changed files with 13 additions and 3 deletions

View File

@@ -78,6 +78,10 @@ namespace PowerToysSettings
{
json::JsonObject prop_value;
prop_value.SetNamedValue(L"value", json::value(value));
if (!json::has(m_json, L"properties", json::JsonValueType::Object))
{
m_json.SetNamedValue(L"properties", json::JsonObject{});
}
m_json.GetNamedObject(L"properties").SetNamedValue(name, prop_value);
}

View File

@@ -143,11 +143,17 @@ static std::pair<int, int> update_sun_times(auto& settings)
Logger::info(L"[LightSwitchService] Updated sun times and saved to config.");
}
catch (const winrt::hresult_error& e)
{
Logger::error(L"[LightSwitchService] Exception during sun time update: hresult_error 0x{:08X} - {}", e.code(), e.message().c_str());
}
catch (const std::exception& e)
{
std::string msg = e.what();
std::wstring wmsg(msg.begin(), msg.end());
Logger::error(L"[LightSwitchService] Exception during sun time update: {}", wmsg);
Logger::error(L"[LightSwitchService] Exception during sun time update: std::exception - {}", winrt::to_hstring(e.what()).c_str());
}
catch (...)
{
Logger::error(L"[LightSwitchService] Exception during sun time update: unknown exception");
}
return { newLightTime, newDarkTime };