From c117f6c60700c5d064305d596e481bb45aa4b459 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Tue, 13 Dec 2022 19:02:15 +0100 Subject: [PATCH] server: Improve error diagnostics of com_select(). The attempt to select a non-existing mood or playlist currently results in remote: key not found in rbtree This is a bit cryptic, so be a bit more user-friendy and provide a paraslash error code for this case. --- afs.c | 3 ++- error.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/afs.c b/afs.c index b15f8385..000aaa54 100644 --- a/afs.c +++ b/afs.c @@ -1018,7 +1018,8 @@ static int com_select(struct command_context *cc, struct lls_parse_result *lpr) send_errctx(cc, errctx); return ret; } - return send_lls_callback_request(com_select_callback, cmd, lpr, cc); + ret = send_lls_callback_request(com_select_callback, cmd, lpr, cc); + return ret == osl(-E_OSL_RB_KEY_NOT_FOUND)? -E_BAD_MOP : ret; } EXPORT_SERVER_CMD_HANDLER(select); diff --git a/error.h b/error.h index 7c146da2..0e815444 100644 --- a/error.h +++ b/error.h @@ -51,6 +51,7 @@ PARA_ERROR(BAD_CT, "invalid chunk table or bad FEC configuration"), \ PARA_ERROR(BAD_FEATURE, "invalid feature request"), \ PARA_ERROR(BAD_FEC_HEADER, "invalid fec header"), \ + PARA_ERROR(BAD_MOP, "invalid mood or playlist"), \ PARA_ERROR(BAD_PATH, "invalid path"), \ PARA_ERROR(BAD_PRIVATE_KEY, "invalid private key"), \ PARA_ERROR(BAD_SAMPLE_FORMAT, "sample format not supported"), \ -- 2.39.2