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.
pull/32/head
Paul Hollinsky 2021-04-11 22:37:44 -04:00
parent e82b5d15e0
commit d79f735df8
1 changed files with 10 additions and 1 deletions

View File

@ -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;