fix(core): Make expression resolution improvements (#4829)

 Make expression resolution improvements
This commit is contained in:
Iván Ovejero
2022-12-07 12:07:32 +01:00
committed by GitHub
parent 1e4ca1f0d0
commit 0bd13c7173
3 changed files with 59 additions and 8 deletions

View File

@@ -254,6 +254,7 @@ export class Expression {
// Execute the expression
const returnValue = this.renderExpression(parameterValue, data);
if (typeof returnValue === 'function') {
if (returnValue.name === '$') throw new Error('invalid syntax');
throw new Error('Expression resolved to a function. Please add "()"');
} else if (typeof returnValue === 'string') {
return returnValue;
@@ -278,12 +279,8 @@ export class Expression {
}
}
if (
error instanceof Error &&
typeof error.message === 'string' &&
error.name === 'SyntaxError'
) {
throw new Error(error.message);
if (error instanceof Error && error.name === 'SyntaxError') {
throw new Error('invalid syntax');
}
}