mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-11-20 11:36:24 +01:00
Throw after fetching value
This commit is contained in:
parent
63c1f2a7a3
commit
1663782954
@ -44,13 +44,10 @@ function resolveDerivedVariable(decl, {variables, derive}) {
|
||||
const matches = variable.match(RE_VARIABLE_VALUE);
|
||||
if (matches) {
|
||||
const [wholeVariable, baseVariable, operation, argument] = matches;
|
||||
if (!variables[baseVariable]) {
|
||||
// hmm.. baseVariable should be in config..., maybe this is an alias?
|
||||
if (!aliasMap.get(`--${baseVariable}`)) {
|
||||
throw new Error(`Cannot derive from ${baseVariable} because it is neither defined in config nor is it an alias!`);
|
||||
}
|
||||
}
|
||||
const value = variables[baseVariable] ?? getValueFromAlias(baseVariable, variables);
|
||||
if (!value) {
|
||||
throw new Error(`Cannot derive from ${baseVariable} because it is neither defined in config nor is it an alias!`);
|
||||
}
|
||||
const derivedValue = derive(value, operation, argument);
|
||||
resolvedMap.set(wholeVariable, derivedValue);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user