config/Block: GetPath() throws exception on error

This commit is contained in:
Max Kellermann
2016-10-28 23:08:42 +02:00
parent d8bcdca55a
commit e17805f208
8 changed files with 23 additions and 55 deletions

View File

@@ -183,14 +183,10 @@ FifoOutput::Create(const ConfigBlock &block, Error &error)
{
FifoOutput *fd = new FifoOutput();
fd->path = block.GetPath("path", error);
fd->path = block.GetPath("path");
if (fd->path.IsNull()) {
delete fd;
if (!error.IsDefined())
error.Set(config_domain,
"No \"path\" parameter specified");
return nullptr;
throw std::runtime_error("No \"path\" parameter specified");
}
fd->path_utf8 = fd->path.ToUTF8();

View File

@@ -128,9 +128,7 @@ RecorderOutput::Configure(const ConfigBlock &block, Error &error)
return false;
}
path = block.GetPath("path", error);
if (error.IsDefined())
return false;
path = block.GetPath("path");
const char *fmt = block.GetBlockValue("format_path", nullptr);
if (fmt != nullptr)