0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-01 19:22:53 +01:00

ircd::conf: Revert conf item if setter or set callback fails.

This commit is contained in:
Jason Volk 2019-03-11 11:17:35 -07:00
parent 1fa5ebc415
commit 499d9c7c6e

View file

@ -221,24 +221,19 @@ noexcept
bool
ircd::conf::item<void>::set(const string_view &val)
{
const bool ret
{
on_set(val)
};
if(set_cb) try
std::string existing(get()); try
{
if(on_set(val))
if(set_cb)
set_cb();
}
catch(const std::exception &e)
catch(...)
{
log::error
{
"conf item[%s] set callback :%s", e.what()
};
on_set(existing);
throw;
}
return ret;
return true;
}
std::string
@ -262,7 +257,7 @@ const
bool
ircd::conf::item<void>::on_set(const string_view &)
{
return false;
return true;
}
ircd::string_view