Ignore unknown parameters and log a warning (#730)

* Ignore unknown parameters and log a warning

* Added comment

* Updated logging
This commit is contained in:
Uwe Seimet 2022-03-14 01:44:16 +01:00 committed by GitHub
parent 9099d7249c
commit f32c20883e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -126,7 +126,13 @@ void Device::SetParams(const unordered_map<string, string>& params)
this->params = GetDefaultParams();
for (const auto& param : params) {
this->params[param.first] = param.second;
// It is assumed that there are default parameters for all supported parameters
if (this->params.find(param.first) != this->params.end()) {
this->params[param.first] = param.second;
}
else {
LOGWARN("%s", string("Ignored unknown parameter '" + param.first + "'").c_str());
}
}
}