« get me outta code hell

data: Thing.getReference: include name in missing directory throw - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/thing.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-10-24 06:42:27 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-10-24 06:42:27 -0300
commit2b7c3305d916875e98d33102d50ab562834b1e0a (patch)
treeb9ca8c8bcdbf82a268a8714704302531e7dcb870 /src/data/thing.js
parent6b9c8cb3615b7ba7b49d1c21b2748d2e75e7ee82 (diff)
data: Thing.getReference: include name in missing directory throw
Diffstat (limited to 'src/data/thing.js')
-rw-r--r--src/data/thing.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/data/thing.js b/src/data/thing.js
index f719224d..4fbad5f5 100644
--- a/src/data/thing.js
+++ b/src/data/thing.js
@@ -84,7 +84,13 @@ export default class Thing extends CacheableObject {
     }
 
     if (!thing.directory) {
-      throw TypeError(`Passed ${thing.constructor.name} is missing its directory`);
+      if (thing.name) {
+        throw TypeError(
+          `Passed ${thing.constructor.name} (named ${inspect(thing.name)}) ` +
+          `is missing its directory`);
+      } else {
+        throw TypeError(`Passed ${thing.constructor.name} is missing its directory`);
+      }
     }
 
     return `${thing.constructor[Thing.referenceType]}:${thing.directory}`;