« get me outta code hell

fix kinda harmless error in yaml quick load util - 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>2022-05-23 14:43:21 -0300
committer(quasar) nebula <qznebula@protonmail.com>2022-05-23 14:43:37 -0300
commit6fc58e9134803fc74a24bc0514542ce8ff1d347c (patch)
tree901412ce302ccd7cd7bfc9efdead19256a006146
parent2f576a57864446882efc9e93a95a628bd17523c0 (diff)
fix kinda harmless error in yaml quick load util
-rw-r--r--src/data/yaml.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/data/yaml.js b/src/data/yaml.js
index 010fce4..32cf729 100644
--- a/src/data/yaml.js
+++ b/src/data/yaml.js
@@ -1170,16 +1170,20 @@ export function filterDuplicateDirectories(wikiData) {
         });
     }
 
+    // TODO: This code closes the aggregate but it generally gets closed again
+    // by the caller. This works but it might be weird to assume closing an
+    // aggregate twice is okay, maybe there's a better solution? Expose a new
+    // function on aggregates for checking if it *would* error?
+    // (i.e: errors.length > 0)
     try {
         aggregate.close();
-        return aggregate;
     } catch (error) {
         // Duplicate entries were found and filtered out, resulting in altered
         // wikiData arrays. These must be re-linked so objects receive the new
         // data.
         linkWikiDataArrays(wikiData);
-        return error;
     }
+    return aggregate;
 }
 
 // Warn about references across data which don't match anything.  This involves