CFG: catch exceptions

This commit is contained in:
Nekotekina 2017-08-02 13:23:12 +03:00
parent faf9ed9fec
commit f6c8f46462
1 changed files with 6 additions and 1 deletions

View File

@ -276,11 +276,16 @@ std::string cfg::node::to_string() const
return {out.c_str(), out.size()};
}
bool cfg::node::from_string(const std::string& value)
bool cfg::node::from_string(const std::string& value) try
{
cfg::decode(YAML::Load(value), *this);
return true;
}
catch (const std::exception& e)
{
cfg.fatal("%s thrown: %s", typeid(e).name(), e.what());
return false;
}
void cfg::node::from_default()
{