Fixed issue where when throwing "function not found" error with no parameters would throw a useless exception
This commit is contained in:
parent
a2c6943c3a
commit
4790cc74d2
|
@ -88,10 +88,17 @@ namespace Upsilon.Evaluator
|
|||
var function = (ScriptRuntimeFunction) statement;
|
||||
var option = function.GetValidOption(parameters);
|
||||
if (option == null)
|
||||
{
|
||||
if (parameters == null)
|
||||
{
|
||||
throw new EvaluationException(_script.FileName,
|
||||
$"No function found with name '{functionName}' and no parameters.",
|
||||
e.Span);
|
||||
}
|
||||
throw new EvaluationException(_script.FileName,
|
||||
$"No function found with name '{functionName}' and available parameters {string.Join(", ", parameters.Select(x => $"{x.GetType().Name}"))}",
|
||||
e.Span);
|
||||
|
||||
}
|
||||
var result = option.Run(_diagnostics, parameters?.Select(x => x.ToScriptType()).ToArray(), _script, Scope, new TextSpan());
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue