encoder/Plugin: migrate from class Error to C++ exceptions

This commit is contained in:
Max Kellermann
2016-10-28 21:29:01 +02:00
parent aead221184
commit 0c343cb1c3
15 changed files with 145 additions and 257 deletions

View File

@@ -194,9 +194,7 @@ ShoutOutput::Configure(const ConfigBlock &block, Error &error)
return false;
}
prepared_encoder = encoder_init(*encoder_plugin, block, error);
if (prepared_encoder == nullptr)
return false;
prepared_encoder = encoder_init(*encoder_plugin, block);
unsigned shout_format;
if (strcmp(encoding, "mp3") == 0 || strcmp(encoding, "lame") == 0)
@@ -304,9 +302,14 @@ ShoutOutput::Create(const ConfigBlock &block, Error &error)
return nullptr;
}
if (!sd->Configure(block, error)) {
try {
if (!sd->Configure(block, error)) {
delete sd;
return nullptr;
}
} catch (...) {
delete sd;
return nullptr;
throw;
}
return sd;