You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current implementation of undici version 7.1.0 throws a ResponseError object type when a request fails with a statusCode greater than 400. However, the TypeScript types do not include a definition for ResponseError.
Additionally, there is a ResponseStatusCodeError type defined in the TypeScript types, which seems to be intended for such scenarios. This creates an inconsistency, as the code throws ResponseError while the typings suggest ResponseStatusCodeError should be used.
Reproducible By
Make a request that returns a statusCode > 400.
Observe that the error thrown is a ResponseError with UND_ERR_RESPONSE code , which is not part of the TypeScript definitions.
Expected Behavior
The error thrown when a request fails with statusCode > 400 should either:
Be updated to throw a ResponseStatusCodeError, matching the TypeScript definitions.
Have the missing ResponseError type reintroduced in the TypeScript definitions, if it is the intended behavior.
The text was updated successfully, but these errors were encountered:
Only partially, and not in the right direction. The ResponseError is only being used in response error interceptor. Instead of creating the type, it might be better to address the root issue, eliminate ResponseError (if it’s confirmed that it’s only used there), and move to using specific errors (such as ResponseStatusCodeError in this case).
Bug Description
The current implementation of undici version 7.1.0 throws a ResponseError object type when a request fails with a statusCode greater than 400. However, the TypeScript types do not include a definition for ResponseError.
Additionally, there is a ResponseStatusCodeError type defined in the TypeScript types, which seems to be intended for such scenarios. This creates an inconsistency, as the code throws ResponseError while the typings suggest ResponseStatusCodeError should be used.
Reproducible By
Expected Behavior
The error thrown when a request fails with statusCode > 400 should either:
The text was updated successfully, but these errors were encountered: