Commit cf2b8146 authored by Max Kellermann's avatar Max Kellermann

output/Init: migrate Configure() from class Error to C++ exceptions

parent bbe7a373
......@@ -58,9 +58,7 @@ AudioOutput::AudioOutput(const AudioOutputPlugin &_plugin,
assert(plugin.close != nullptr);
assert(plugin.play != nullptr);
Error error;
if (!Configure(block, error))
throw std::runtime_error(error.GetMessage());
Configure(block);
}
static const AudioOutputPlugin *
......@@ -155,16 +153,13 @@ audio_output_load_mixer(EventLoop &event_loop, AudioOutput &ao,
gcc_unreachable();
}
bool
AudioOutput::Configure(const ConfigBlock &block, Error &error)
void
AudioOutput::Configure(const ConfigBlock &block)
{
if (!block.IsNull()) {
name = block.GetBlockValue(AUDIO_OUTPUT_NAME);
if (name == nullptr) {
error.Set(config_domain,
"Missing \"name\" configuration");
return false;
}
if (name == nullptr)
throw std::runtime_error("Missing \"name\" configuration");
const char *p = block.GetBlockValue(AUDIO_OUTPUT_FORMAT);
if (p != nullptr)
......@@ -208,10 +203,6 @@ AudioOutput::Configure(const ConfigBlock &block, Error &error)
"Failed to initialize filter chain for '%s'",
name);
}
/* done */
return true;
}
static bool
......
......@@ -291,7 +291,7 @@ struct AudioOutput {
~AudioOutput();
private:
bool Configure(const ConfigBlock &block, Error &error);
void Configure(const ConfigBlock &block);
public:
void StartThread();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment