decoder/Thread, ...: log all exceptions

This commit is contained in:
Max Kellermann 2018-08-09 11:14:40 +02:00
parent 87570cdd9b
commit 01d3777574
8 changed files with 19 additions and 20 deletions

View File

@ -545,8 +545,8 @@ int mpd_main(int argc, char *argv[]) noexcept
try { try {
return MainOrThrow(argc, argv); return MainOrThrow(argc, argv);
} catch (const std::exception &e) { } catch (...) {
LogError(e); LogError(std::current_exception());
return EXIT_FAILURE; return EXIT_FAILURE;
} }
} }

View File

@ -102,8 +102,8 @@ StateFile::Write()
FileOutputStream fos(config.path); FileOutputStream fos(config.path);
Write(fos); Write(fos);
fos.Commit(); fos.Commit();
} catch (const std::exception &e) { } catch (...) {
LogError(e); LogError(std::current_exception());
} }
RememberVersions(); RememberVersions();
@ -143,8 +143,8 @@ try {
} }
RememberVersions(); RememberVersions();
} catch (const std::exception &e) { } catch (...) {
LogError(e); LogError(std::current_exception());
} }
void void

View File

@ -179,8 +179,8 @@ handle_lsinfo_relative(Client &client, Response &r, const char *uri)
if (isRootDirectory(uri)) { if (isRootDirectory(uri)) {
try { try {
print_spl_list(r, ListPlaylistFiles()); print_spl_list(r, ListPlaylistFiles());
} catch (const std::exception &e) { } catch (...) {
LogError(e); LogError(std::current_exception());
} }
} else { } else {
#ifndef ENABLE_DATABASE #ifndef ENABLE_DATABASE

View File

@ -175,8 +175,8 @@ SimpleDatabase::Open()
try { try {
Load(); Load();
} catch (const std::exception &e) { } catch (...) {
LogError(e); LogError(std::current_exception());
delete root; delete root;

View File

@ -234,8 +234,8 @@ try {
FormatDebug(update_domain, FormatDebug(update_domain,
"%s is not a directory, archive or music", name); "%s is not a directory, archive or music", name);
} }
} catch (const std::exception &e) { } catch (...) {
LogError(e); LogError(std::current_exception());
} }
/* we don't look at "." / ".." nor files with newlines in their name */ /* we don't look at "." / ".." nor files with newlines in their name */
@ -477,8 +477,8 @@ try {
ExcludeList exclude_list; ExcludeList exclude_list;
UpdateDirectoryChild(*parent, exclude_list, name, info); UpdateDirectoryChild(*parent, exclude_list, name, info);
} catch (const std::exception &e) { } catch (...) {
LogError(e); LogError(std::current_exception());
} }
bool bool

View File

@ -536,9 +536,8 @@ DecoderControl::RunThread() noexcept
if (state == DecoderState::ERROR) { if (state == DecoderState::ERROR) {
try { try {
std::rethrow_exception(error); std::rethrow_exception(error);
} catch (const std::exception &e) {
LogError(e);
} catch (...) { } catch (...) {
LogError(std::current_exception());
} }
} }

View File

@ -255,9 +255,9 @@ FfmpegSendFrame(DecoderClient &client, InputStream &is,
try { try {
output_buffer = copy_interleave_frame(codec_context, frame, output_buffer = copy_interleave_frame(codec_context, frame,
buffer); buffer);
} catch (const std::exception &e) { } catch (...) {
/* this must be a serious error, e.g. OOM */ /* this must be a serious error, e.g. OOM */
LogError(e); LogError(std::current_exception());
return DecoderCommand::STOP; return DecoderCommand::STOP;
} }

View File

@ -81,8 +81,8 @@ UPnPDeviceDirectory::Downloader::OnEnd()
try { try {
d.Parse(url, data.c_str()); d.Parse(url, data.c_str());
} catch (const std::exception &e) { } catch (...) {
LogError(e); LogError(std::current_exception());
} }
parent.LockAdd(std::move(d)); parent.LockAdd(std::move(d));