« get me outta code hell

sugar: showAggregate: display top-level non-AggregateErrors w/ more detail - 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>2023-08-21 22:14:04 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-08-21 22:14:04 -0300
commit3adf33b567c53e79ce45a36031b29da719fb2377 (patch)
treeddd33b777e3fa0069857a5c6c63a1fe3d6a79911
parentb90c2072f1ef8f55ef495bfa3920af4bb482f0cd (diff)
sugar: showAggregate: display top-level non-AggregateErrors w/ more detail
-rw-r--r--src/util/sugar.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/util/sugar.js b/src/util/sugar.js
index 487c093c..5b1f3193 100644
--- a/src/util/sugar.js
+++ b/src/util/sugar.js
@@ -574,7 +574,12 @@ export function showAggregate(topError, {
     }
   };
 
-  const message = recursive(topError, {level: 0});
+  const message =
+    (topError instanceof AggregateError
+      ? recursive(topError, {level: 0})
+      : (showTraces
+          ? topError.stack
+          : topError.toString()));
 
   if (print) {
     console.error(message);