« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/content-function.js6
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};