From cf2b814629d34c22909f707a7d955fd019503609 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 9 Nov 2016 12:06:54 +0100 Subject: [PATCH] output/Init: migrate Configure() from class Error to C++ exceptions --- src/output/Init.cxx | 19 +++++-------------- src/output/Internal.hxx | 2 +- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/output/Init.cxx b/src/output/Init.cxx index afdf50b7d..bd7870914 100644 --- a/src/output/Init.cxx +++ b/src/output/Init.cxx @@ -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 diff --git a/src/output/Internal.hxx b/src/output/Internal.hxx index 8512ecf97..90d3f4d1a 100644 --- a/src/output/Internal.hxx +++ b/src/output/Internal.hxx @@ -291,7 +291,7 @@ struct AudioOutput { ~AudioOutput(); private: - bool Configure(const ConfigBlock &block, Error &error); + void Configure(const ConfigBlock &block); public: void StartThread();