command/CommandError: move code to ToAck(DatabaseErrorCode)
This commit is contained in:
parent
0d8e44a079
commit
6a789b660a
@ -66,6 +66,24 @@ ToAck(PlaylistResult result)
|
|||||||
return ACK_ERROR_UNKNOWN;
|
return ACK_ERROR_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_DATABASE
|
||||||
|
gcc_const
|
||||||
|
static enum ack
|
||||||
|
ToAck(DatabaseErrorCode code)
|
||||||
|
{
|
||||||
|
switch (code) {
|
||||||
|
case DatabaseErrorCode::DISABLED:
|
||||||
|
case DatabaseErrorCode::NOT_FOUND:
|
||||||
|
return ACK_ERROR_NO_EXIST;
|
||||||
|
|
||||||
|
case DatabaseErrorCode::CONFLICT:
|
||||||
|
return ACK_ERROR_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ACK_ERROR_UNKNOWN;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CommandResult
|
CommandResult
|
||||||
print_playlist_result(Response &r, PlaylistResult result)
|
print_playlist_result(Response &r, PlaylistResult result)
|
||||||
{
|
{
|
||||||
@ -129,14 +147,7 @@ ToAck(const Error &error)
|
|||||||
return (enum ack)error.GetCode();
|
return (enum ack)error.GetCode();
|
||||||
#ifdef ENABLE_DATABASE
|
#ifdef ENABLE_DATABASE
|
||||||
} else if (error.IsDomain(db_domain)) {
|
} else if (error.IsDomain(db_domain)) {
|
||||||
switch ((DatabaseErrorCode)error.GetCode()) {
|
return ToAck((DatabaseErrorCode)error.GetCode());
|
||||||
case DatabaseErrorCode::DISABLED:
|
|
||||||
case DatabaseErrorCode::NOT_FOUND:
|
|
||||||
return ACK_ERROR_NO_EXIST;
|
|
||||||
|
|
||||||
case DatabaseErrorCode::CONFLICT:
|
|
||||||
return ACK_ERROR_ARG;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
} else if (error.IsDomain(locate_uri_domain)) {
|
} else if (error.IsDomain(locate_uri_domain)) {
|
||||||
return ACK_ERROR_ARG;
|
return ACK_ERROR_ARG;
|
||||||
|
Loading…
Reference in New Issue
Block a user