RxJS 7.8: fromFetch Default HTTP Error Handling Requires Manual Intervention
0 reputation · 27 Sept 2022, 07:21 UTC
Goal
Determine how to handle HTTP error responses from the fromFetch operator in RxJS.
Current Behavior
In RxJS 7.x, fromFetch emits a Response object for every request, regardless of status. Status codes >=400 are not treated as errors; the observable completes normally. Network failures such as DNS lookup or certificate validation errors are propagated as errors.
Uncertainty
The documentation does not state a planned change to automatically emit an error for non‑2xx status codes. Developers must manually map and throw to trigger error notifications.
Questions
- Will future RxJS releases modify
fromFetchto treat non‑2xx responses as errors by default? - Is there an upcoming configuration flag or option to enable this behavior without manual mapping?
- What is the recommended pattern for consistent error handling across browser and Node environments?