evalVariable: Thows ShellVariableError if no variable is found

This commit is contained in:
Sekulum Forka 2021-05-13 11:25:28 +02:00
parent cdae96263b
commit aa528eb717
1 changed files with 5 additions and 1 deletions

View File

@ -161,7 +161,11 @@ proc evalVariable(vari: string): string =
result=shellVariables[vari]
elif envVariables.hasKey(vari):
result = envVariables[vari]
else: raise newException(Exception, "No such variable: " & vari & ".")
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
proc substitute(strm: Stream, delim=";\p"): string =