Improved error handling for most calculations
This commit is contained in:
@@ -4,6 +4,6 @@ export default function embedInlineCalculations(string, calculations){
|
||||
let index = 0;
|
||||
return string.replace(/\{([^{}]*)\}/g, () => {
|
||||
let comp = calculations && calculations[index++];
|
||||
return comp && comp.result;
|
||||
return comp && comp.result ? comp.result : string;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -18,11 +18,6 @@ export default function evaluateString(string, scope, fn = 'compile'){
|
||||
errors.push(e);
|
||||
return {result: string, errors};
|
||||
}
|
||||
// Parsing failed
|
||||
if (node === null){
|
||||
errors.push('...');
|
||||
return {result: string, errors};
|
||||
}
|
||||
let context = new CompilationContext();
|
||||
let result = node[fn](scope, context);
|
||||
if (result instanceof ConstantNode){
|
||||
|
||||
Reference in New Issue
Block a user