+-------------------------------------------------------------------
+Tue May 03 08:46:28 CEST 2022 - aschnell@suse.com
+
+- fixed error handling when reading configs
+ (gh#openSUSE/snapper#715)
+
-------------------------------------------------------------------
Thu Apr 21 09:35:06 CEST 2022 - aschnell@suse.com
namespace snapper
{
+ using std::map;
+
+
SnapperContexts::SnapperContexts()
{
- std::map<string,string> snapperd_contexts;
+ map<string, string> snapperd_contexts;
try
{
}
}
}
- catch (const FileNotFoundException& e)
+ catch (const Exception& e)
{
SN_CAUGHT(e);
SN_THROW(SelinuxException("Failed to parse contexts file"));
}
- std::map<string,string>::const_iterator cit = snapperd_contexts.find(selinux_snapperd_data);
+ map<string, string>::const_iterator cit = snapperd_contexts.find(selinux_snapperd_data);
if (cit == snapperd_contexts.end())
{
SN_THROW(SelinuxException("Snapperd data context not found"));
{
config_info = new ConfigInfo(config_name, root_prefix);
}
- catch (const FileNotFoundException& e)
+ catch (const Exception& e)
{
SN_CAUGHT(e);
vector<string> config_names;
sysconfig.get_value("SNAPPER_CONFIGS", config_names);
- for (vector<string>::const_iterator it = config_names.begin(); it != config_names.end(); ++it)
+ for (const string& config_name : config_names)
{
try
{
- config_infos.push_back(getConfig(*it, root_prefix));
- }
- catch (const FileNotFoundException& e)
- {
- SN_CAUGHT(e);
-
- y2err("config '" << *it << "' not found");
+ config_infos.push_back(getConfig(config_name, root_prefix));
}
- catch (const InvalidConfigException& e)
+ catch (const Exception& e)
{
SN_CAUGHT(e);
- y2err("config '" << *it << "' is invalid");
+ y2err("reading config '" << config_name << "' failed");
}
}
}
- catch (const FileNotFoundException& e)
+ catch (const Exception& e)
{
SN_CAUGHT(e);
- SN_THROW(ListConfigsFailedException("sysconfig-file not found"));
+ SN_THROW(ListConfigsFailedException("reading sysconfig-file failed"));
}
return config_infos;
sysconfig.save();
}
- catch (const FileNotFoundException& e)
+ catch (const Exception& e)
{
SN_CAUGHT(e);
config.save();
}
- catch (const FileNotFoundException& e)
+ catch (const Exception& e)
{
SN_CAUGHT(e);
sysconfig.save();
}
- catch (const FileNotFoundException& e)
+ catch (const Exception& e)
{
SN_CAUGHT(e);
- SN_THROW(DeleteConfigFailedException("sysconfig-file not found"));
+ SN_THROW(DeleteConfigFailedException("modifying sysconfig-file failed"));
}
}