diff options
author | Max Kellermann <max@duempel.org> | 2013-10-30 16:02:44 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-10-30 16:04:21 +0100 |
commit | 7bb3987acc264457920ac596d2c81c338a651ca2 (patch) | |
tree | ecfdd9c906c2409041304c16a019a608085ffb7a /src | |
parent | 6a147a17af10af3852aed3549858d6aae75a8841 (diff) | |
download | mpd-7bb3987acc264457920ac596d2c81c338a651ca2.tar.gz mpd-7bb3987acc264457920ac596d2c81c338a651ca2.tar.xz mpd-7bb3987acc264457920ac596d2c81c338a651ca2.zip |
db/proxy: return server errors using "enum ack"
Diffstat (limited to 'src')
-rw-r--r-- | src/db/ProxyDatabasePlugin.cxx | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/db/ProxyDatabasePlugin.cxx b/src/db/ProxyDatabasePlugin.cxx index 05d023668..4c8498d69 100644 --- a/src/db/ProxyDatabasePlugin.cxx +++ b/src/db/ProxyDatabasePlugin.cxx @@ -31,6 +31,7 @@ #include "tag/TagBuilder.hxx" #include "util/Error.hxx" #include "util/Domain.hxx" +#include "protocol/Ack.hxx" #undef MPD_DIRECTORY_H #undef MPD_SONG_H @@ -120,8 +121,18 @@ CheckError(struct mpd_connection *connection, Error &error) if (code == MPD_ERROR_SUCCESS) return true; - error.Set(libmpdclient_domain, (int)code, - mpd_connection_get_error_message(connection)); + if (code == MPD_ERROR_SERVER) { + /* libmpdclient's "enum mpd_server_error" is the same + as our "enum ack" */ + const auto server_error = + mpd_connection_get_server_error(connection); + error.Set(ack_domain, (int)server_error, + mpd_connection_get_error_message(connection)); + } else { + error.Set(libmpdclient_domain, (int)code, + mpd_connection_get_error_message(connection)); + } + mpd_connection_clear_error(connection); return false; } |