fix: body already used error to throw TypeError (#24114)

Should fix https://github.com/oven-sh/bun/issues/24104

### What does this PR do?

This PR is changing `ERR_BODY_ALREADY_USED` to be TypeError instead of
Error.


### How did you verify your code works?
A test case added to verify that request call correctly throws a
TypeError after another request call on the same Request, confirming the
fix addresses the issue.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Felipe Cardozo
2025-10-27 22:31:33 -03:00
committed by GitHub
parent 668eba0eb8
commit a0a69ee146
2 changed files with 17 additions and 10 deletions

View File

@@ -20,7 +20,7 @@ const errors: ErrorCodeMapping = [
["ERR_ASSERTION", Error],
["ERR_ASYNC_CALLBACK", TypeError],
["ERR_ASYNC_TYPE", TypeError],
["ERR_BODY_ALREADY_USED", Error],
["ERR_BODY_ALREADY_USED", TypeError],
["ERR_BORINGSSL", Error],
["ERR_ZSTD", Error],
["ERR_BROTLI_INVALID_PARAM", RangeError],