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

This commit is contained in:
Max Kellermann 2016-11-09 12:06:54 +01:00
parent bbe7a37359
commit cf2b814629
2 changed files with 6 additions and 15 deletions

View File

@ -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

View File

@ -291,7 +291,7 @@ struct AudioOutput {
~AudioOutput();
private:
bool Configure(const ConfigBlock &block, Error &error);
void Configure(const ConfigBlock &block);
public:
void StartThread();