diff options
author | 2022-11-28 18:30:28 -0800 | |
---|---|---|
committer | 2022-11-28 18:30:28 -0800 | |
commit | eccd854dbc50444a3665b31f170ab94451f3cd04 (patch) | |
tree | 5f1022db679d3540dbe9d163eacbd9333fd850b2 | |
parent | a64f2f5466a28894ae7ad4a7cfe7c6cb5b2d117c (diff) | |
download | bun-eccd854dbc50444a3665b31f170ab94451f3cd04.tar.gz bun-eccd854dbc50444a3665b31f170ab94451f3cd04.tar.zst bun-eccd854dbc50444a3665b31f170ab94451f3cd04.zip |
Ensure we report errors in controller.close
-rw-r--r-- | src/bun.js/builtins/js/ReadableStreamInternals.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/bun.js/builtins/js/ReadableStreamInternals.js b/src/bun.js/builtins/js/ReadableStreamInternals.js index fd99ab2ea..15042baa5 100644 --- a/src/bun.js/builtins/js/ReadableStreamInternals.js +++ b/src/bun.js/builtins/js/ReadableStreamInternals.js @@ -1866,6 +1866,14 @@ function lazyLoadStream(stream, autoAllocateChunkSize) { handleResult(val, c, v); } + function callClose(controller) { + try { + controller.close(); + } catch(e) { + globalThis.reportError(e); + } + } + handleResult = function handleResult(result, controller, view) { "use strict"; if (result && @isPromise(result)) { @@ -1887,7 +1895,7 @@ function lazyLoadStream(stream, autoAllocateChunkSize) { } if (closer[0] || result === false) { - @enqueueJob(() => controller.close()); + @enqueueJob(callClose, controller); closer[0] = false; } }; |