diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-06-02 09:37:41 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-06-02 09:37:41 -0300 |
commit | 0f0b19c6027e289f5fdce039ebabf52ee3cc9fc8 (patch) | |
tree | 9349deeda6d9a3fadff976ca221a1d3d7c98191c /src | |
parent | 405e52004060d6db628010c8593d5663ea1f3032 (diff) |
infra: early error when relation() called w/ unlisted dependency
Diffstat (limited to 'src')
-rw-r--r-- | src/content-function.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/content-function.js b/src/content-function.js index 921b5bcd..3536d5a8 100644 --- a/src/content-function.js +++ b/src/content-function.js @@ -219,6 +219,8 @@ export function getRelationsTree(dependencies, contentFunctionName, wikiData, .. return null; } + const listedDependencies = new Set(contentFunction.contentDependencies); + // TODO: Evaluating a sprawl might belong somewhere better than here, lol... const sprawl = (contentFunction.sprawl @@ -233,6 +235,10 @@ export function getRelationsTree(dependencies, contentFunctionName, wikiData, .. })(); const relationFunction = (name, ...args) => { + if (!listedDependencies.has(name)) { + throw new Error(`Called relation('${name}') but ${contentFunctionName} doesn't list that dependency`); + } + const relationSymbol = Symbol(relationSymbolMessage(name)); relationSlots[relationSymbol] = {name, args}; return {[relationIdentifier]: relationSymbol}; |