Main, ...: catch any exception, not just std::runtime_error

This commit is contained in:
Max Kellermann
2017-12-19 10:56:23 +01:00
parent a539094c06
commit 914df18bf9
79 changed files with 236 additions and 244 deletions
+11 -11
View File
@@ -154,7 +154,7 @@ RecorderOutput::Open(AudioFormat &audio_format)
try {
encoder = prepared_encoder->Open(audio_format);
} catch (const std::runtime_error &) {
} catch (...) {
delete file;
throw;
}
@@ -162,7 +162,7 @@ RecorderOutput::Open(AudioFormat &audio_format)
if (!HasDynamicPath()) {
try {
EncoderToFile();
} catch (const std::runtime_error &) {
} catch (...) {
delete encoder;
throw;
}
@@ -218,8 +218,8 @@ RecorderOutput::Close() noexcept
try {
Commit();
} catch (const std::exception &e) {
LogError(e);
} catch (...) {
LogError(std::current_exception());
}
if (HasDynamicPath()) {
@@ -238,8 +238,8 @@ RecorderOutput::FinishFormat()
try {
Commit();
} catch (const std::exception &e) {
LogError(e);
} catch (...) {
LogError(std::current_exception());
}
file = nullptr;
@@ -270,7 +270,7 @@ RecorderOutput::ReopenFormat(AllocatedPath &&new_path)
try {
EncoderToOutputStream(*new_file, *encoder);
} catch (const std::exception &e) {
} catch (...) {
delete encoder;
delete new_file;
throw;
@@ -302,8 +302,8 @@ RecorderOutput::SendTag(const Tag &tag)
try {
new_path = ParsePath(p);
} catch (const std::runtime_error &e) {
LogError(e);
} catch (...) {
LogError(std::current_exception());
FinishFormat();
return;
}
@@ -313,8 +313,8 @@ RecorderOutput::SendTag(const Tag &tag)
try {
ReopenFormat(std::move(new_path));
} catch (const std::runtime_error &e) {
LogError(e);
} catch (...) {
LogError(std::current_exception());
return;
}
}