]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
server: Improve error diagnostics of com_select().
authorAndre Noll <maan@tuebingen.mpg.de>
Tue, 13 Dec 2022 18:02:15 +0000 (19:02 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Sat, 11 Mar 2023 18:16:46 +0000 (19:16 +0100)
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
error.h

diff --git a/afs.c b/afs.c
index b15f83852e6919c4f0867065d13776c211416087..000aaa54670714a195a6d8bce3e12f3f723017dc 100644 (file)
--- 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 7c146da2076ae74d896bb82a0e931d8b5b6f49f5..0e815444b821b6e5d7796a478a5fc209fd623c01 100644 (file)
--- 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"), \