Filter/Internal: migrate from class Error to C++ exceptions

This commit is contained in:
Max Kellermann
2016-09-04 14:32:09 +02:00
parent 28c6975732
commit 13c32111a0
14 changed files with 142 additions and 191 deletions

View File

@@ -105,13 +105,7 @@ try {
/* open the filter */
Error error;
std::unique_ptr<Filter> filter(prepared_filter->Open(audio_format,
error));
if (!filter) {
LogError(error, "Failed to open filter");
return EXIT_FAILURE;
}
std::unique_ptr<Filter> filter(prepared_filter->Open(audio_format));
const AudioFormat out_audio_format = filter->GetOutAudioFormat();
@@ -127,12 +121,7 @@ try {
if (nbytes <= 0)
break;
auto dest = filter->FilterPCM({(const void *)buffer, (size_t)nbytes},
error);
if (dest.IsNull()) {
LogError(error, "filter/Filter failed");
return EXIT_FAILURE;
}
auto dest = filter->FilterPCM({(const void *)buffer, (size_t)nbytes});
nbytes = write(1, dest.data, dest.size);
if (nbytes < 0) {
@@ -147,7 +136,7 @@ try {
config_global_finish();
return EXIT_SUCCESS;
} catch (const std::exception &e) {
} catch (const std::exception &e) {
LogError(e);
return EXIT_FAILURE;
}
}