« get me outta code hell

data steps: unfinished behavior & fixes in test lib - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-03-28 19:49:53 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-03-28 19:49:53 -0300
commitb6393b1d3fc9adc59bc387b8013cbad30e3a164f (patch)
treea7ef59111434bb83e85eed47603d47ca4d645fec /src/util
parentc6f1011722dc6fe50afb3a63ee414c70dbfd6abf (diff)
data steps: unfinished behavior & fixes in test lib
Diffstat (limited to 'src/util')
-rw-r--r--src/util/sugar.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/util/sugar.js b/src/util/sugar.js
index ad36d16b..f3b9e732 100644
--- a/src/util/sugar.js
+++ b/src/util/sugar.js
@@ -431,6 +431,7 @@ export function _withAggregate(mode, aggregateOpts, fn) {
 export function showAggregate(topError, {
   pathToFileURL = f => f,
   showTraces = true,
+  print = true,
 } = {}) {
   const recursive = (error, {level}) => {
     let header = showTraces
@@ -475,7 +476,13 @@ export function showAggregate(topError, {
     }
   };
 
-  console.error(recursive(topError, {level: 0}));
+  const message = recursive(topError, {level: 0});
+
+  if (print) {
+    console.error(message);
+  } else {
+    return message;
+  }
 }
 
 export function decorateErrorWithIndex(fn) {