« get me outta code hell

find: fix up warnOrThrow internal usage - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-03-17 12:08:18 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-03-17 12:08:32 -0300
commit2b232324435e175626e382eaad02fbccc5f45e9b (patch)
tree2ca979e0f0327a9eb73762297b59c3b48f8d5b2a
parentb9e441d8e1d89fd7c89674eb08201073c16fd955 (diff)
find: fix up warnOrThrow internal usage
-rw-r--r--src/find.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/find.js b/src/find.js
index 2d162af2..afe34dd9 100644
--- a/src/find.js
+++ b/src/find.js
@@ -114,7 +114,8 @@ function findHelper({
 
     const regexMatch = fullRef.match(keyRefRegex);
     if (!regexMatch) {
-      warnOrThrow(mode, `Malformed link reference: "${fullRef}"`);
+      return warnOrThrow(mode,
+        `Malformed link reference: "${fullRef}"`);
     }
 
     const typePart = regexMatch[1];
@@ -142,8 +143,8 @@ function findHelper({
     }
 
     if (!match) {
-      warnOrThrow(mode, `Didn't match anything for ${colors.bright(fullRef)}`);
-      return null;
+      return warnOrThrow(mode,
+        `Didn't match anything for ${colors.bright(fullRef)}`);
     }
 
     return match;