From 285eb06f0ecdf44cfa92e583c10fda84706355a3 Mon Sep 17 00:00:00 2001 From: Sekulum Forka Date: Thu, 13 May 2021 11:27:53 +0200 Subject: [PATCH] Builtins: set: Throws an exception if not enough arguments are provided --- src/fsh.nim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/fsh.nim b/src/fsh.nim index 7d9cbbd..cf3297c 100644 --- a/src/fsh.nim +++ b/src/fsh.nim @@ -164,7 +164,6 @@ proc evalVariable(vari: string): string = else: var e = newException(ShellVariableError, "No such variable: " & vari) e.variable = vari - e.msg = "No such variable: " & e.variable raise e # substitute does a substitution on the stream passed in @@ -220,7 +219,9 @@ proc runBuiltin(builtin: string, args: openArray[string]): string = case builtin: of "set": if args.len < 2: - raise newException(Exception, "Set: not enough arguments provided") + var e = newException(ShellCommandError, "Set: not enough arguments provided") + e.command="set" + raise e shellVariables[args[0]] = args[1..^1].join(" ") return "" of "setenv":