diff --git a/index.js b/index.js index 988af8b..ddf8038 100644 --- a/index.js +++ b/index.js @@ -3,6 +3,7 @@ const Promise = require("bluebird"); const propagateAbort = require("@promistream/propagate-abort"); const unreachable = require("@joepie91/unreachable")("@promistream/buffer"); +const util = require("util"); module.exports = function bufferStream() { let buffer; @@ -20,7 +21,11 @@ module.exports = function bufferStream() { return attemptRead(readFunc); } } else { - throw new Error("Buffered stream produced a non-array value"); + // FIXME: Make this its own module, and improve its compactness? + let stringified = util.inspect(result, { depth: 0 }) + .replace(/\s+/g, " "); + + throw new Error(`Buffered stream produced a non-array value: ${stringified}`); } }); }