From d79f735df8c42429e39e94da4377f9e658a17726 Mon Sep 17 00:00:00 2001 From: Paul Hollinsky Date: Sun, 11 Apr 2021 22:37:44 -0400 Subject: [PATCH] Settings: Fix an issue where read errors were not properly reported Since we were not failing the open for a settings read failure, any errors would go unnoticed. --- device/device.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/device/device.cpp b/device/device.cpp index d29a78c..e0d9141 100644 --- a/device/device.cpp +++ b/device/device.cpp @@ -202,8 +202,17 @@ bool Device::open() { return false; } - if(!settings->disabled) + if(!settings->disabled) { + // Since we will not fail the open if a settings read fails, + // downgrade any errors to warnings. Otherwise the error will + // go unnoticed in the opening thread's getLastError buffer. + const bool downgrading = EventManager::GetInstance().isDowngradingErrorsOnCurrentThread(); + if(!downgrading) + EventManager::GetInstance().downgradeErrorsOnCurrentThread(); settings->refresh(); + if(!downgrading) + EventManager::GetInstance().cancelErrorDowngradingOnCurrentThread(); + } MessageFilter filter; filter.includeInternalInAny = true;