« get me outta code hell

sugar: errors - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2026-05-05 12:15:22 -0300
committer(quasar) nebula <qznebula@protonmail.com>2026-05-05 12:15:22 -0300
commit919e4ae20974fb61742d100b9a7f1b951f8f9bc8 (patch)
tree8fd96a0511ad0056611376d5adc9f2cdf8cf7248 /src
parented518ef2ac4a96de9ba90d4e907eaf9ceb4e4f10 (diff)
sugar: errors
Diffstat (limited to 'src')
-rw-r--r--src/common-util/sugar.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/common-util/sugar.js b/src/common-util/sugar.js
index 26f33c20..67083293 100644
--- a/src/common-util/sugar.js
+++ b/src/common-util/sugar.js
@@ -441,6 +441,15 @@ export function promiseWithResolvers() {
   return obj;
 }
 
+export function errors(fn) {
+  try {
+    fn();
+    return false;
+  } catch {
+    return true;
+  }
+}
+
 // Stolen from here: https://stackoverflow.com/a/3561711
 //
 // There's a proposal for a native JS function like this, 8ut it's not even