Compare commits

..

3 Commits

3 changed files with 14 additions and 16 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 };

View File

@@ -9,7 +9,6 @@ using System.Linq;
using System.Threading.Tasks;
using System.Windows.Input;
using ManagedCommon;
using Microsoft.PowerToys.Settings.UI.Helpers;
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
@@ -136,18 +135,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private void Frame_NavigationFailed(object sender, NavigationFailedEventArgs e)
{
var sourcePage = e.SourcePageType?.FullName ?? "<unknown>";
if (e.Exception is null)
{
Logger.LogWarning($"Navigation to '{sourcePage}' failed without an exception.");
}
else
{
Logger.LogError($"Navigation to '{sourcePage}' failed.", e.Exception);
}
e.Handled = true;
throw e.Exception;
}
private void Frame_Navigated(object sender, NavigationEventArgs e)