diff --git a/src/functions.c b/src/functions.c index 76e8c21d7..90e36231e 100644 --- a/src/functions.c +++ b/src/functions.c @@ -966,6 +966,8 @@ void functionLoadCommand(client *c) { desc = c->argv[argc_pos++]->ptr; continue; } + addReplyErrorFormat(c, "Unknown option given: %s", (char*)next_arg->ptr); + return; } if (argc_pos >= c->argc) { diff --git a/tests/unit/functions.tcl b/tests/unit/functions.tcl index 48f846e20..6ad61fb5f 100644 --- a/tests/unit/functions.tcl +++ b/tests/unit/functions.tcl @@ -12,6 +12,13 @@ start_server {tags {"scripting"}} { r fcall test 0 } {hello} + test {FUNCTION - Load with unknown argument} { + catch { + r function load LUA test foo bar [get_function_code test {return 'hello'}] + } e + set _ $e + } {*Unknown option given*} + test {FUNCTION - Create an already exiting library raise error} { catch { r function load LUA test [get_function_code test {return 'hello1'}]