command/{Player,Error}: extract messages from nested exceptions

This commit is contained in:
Max Kellermann
2016-12-29 14:28:03 +01:00
parent 256f40d4f5
commit 52652cb609
5 changed files with 100 additions and 11 deletions

View File

@@ -31,6 +31,7 @@
#include "Idle.hxx"
#include "AudioFormat.hxx"
#include "util/ScopeExit.hxx"
#include "util/Exception.hxx"
#ifdef ENABLE_DATABASE
#include "db/update/Service.hxx"
@@ -192,10 +193,9 @@ handle_status(Client &client, gcc_unused Request args, Response &r)
try {
client.player_control.LockCheckRethrowError();
} catch (const std::exception &e) {
r.Format(COMMAND_STATUS_ERROR ": %s\n", e.what());
} catch (...) {
r.Format(COMMAND_STATUS_ERROR ": unknown\n");
r.Format(COMMAND_STATUS_ERROR ": %s\n",
FullMessage(std::current_exception()).c_str());
}
song = playlist.GetNextPosition();