Skip to content

Commit

Permalink
Do not crash if configuration file cannot be written on update
Browse files Browse the repository at this point in the history
  • Loading branch information
lptr committed Dec 15, 2024
1 parent 4cb4113 commit b8c6226
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main/peripherals/Peripheral.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,12 @@ class PeripheralFactory : public PeripheralFactoryBase {
ConfigurationFile<TConfig>* configFile = new ConfigurationFile<TConfig>(FileSystem::get(), "/p/" + name);
mqttRoot->subscribe("config", [name, configFile](const std::string&, const JsonObject& configJson) {
LOGD("Received configuration update for peripheral: %s", name.c_str());
configFile->update(configJson);
try {
configFile->update(configJson);
} catch (const std::exception& e) {
LOGE("Failed to update configuration for peripheral '%s' because %s",
name.c_str(), e.what());
}
});

TDeviceConfig deviceConfig = std::apply([](TDeviceConfigArgs... args) {
Expand Down

0 comments on commit b8c6226

Please sign in to comment.