Open Bug 1836519 Opened 1 year ago Updated 10 months ago

Inconsistent handling of errors in new Response(stream).text()

Categories

(Core :: DOM: Streams, defect)

defect

Tracking

()

People

(Reporter: saschanaz, Assigned: saschanaz)

References

()

Details

new Response(new ReadableStream({
  pull(c) {
    c.error("oh"); // This causes an extra console message that cannot be read by JavaScript
  }
})).text() // DOMException: The operation was aborted.
new Response(new ReadableStream({
  pull(c) {
    throw "oh"; // extra console message as the first example does
  }
})).text() // DOMException: The operation was aborted. 
new Response(new ReadableStream({
  pull(c) {
    throw new Error("oh"); // No message
  }
})).text() // DOMException: The operation was aborted. 
new Response(new ReadableStream({
  pull(c) {
    c.error(new Error("oh")); // Also broken
  }
})).text() // DOMException: The operation was aborted.

Safari passes the original error message to DOMException for all cases while Chrome does not show it anywhere. We should at least be consistent here.

But perhaps the spec should use error.cause?

Severity: -- → S3

This doesn't block the conversion, it can keep the current behavior.

No longer blocks: 1825763
You need to log in before you can comment on or make changes to this bug.