angular/packages/core/rxjs-interop
Andrew Scott 48974c3cf8 fix(core): remove rejectErrors option encourages uncaught exceptions (#60397)
This commit removes the previously added `rejectErrors` option from
`toSignal` which was meant to create similar behavior to what happens
with unhandled errors in `AsyncPipe`.

This option promotes unhandled exceptions and attaches behaviors that we
do not believe are desirable as an option offered by the framework:

* Unhandled errors that are thrown lose the context of where the error
  ocurred. Throwing the error where the signal is read allows error
  handling to be performed at the signal's usage location
* With this feature, the value of the signal remains set to the initial
  value or the previous successful value coming out of the `Observable`.
  We do not feel this is appropriate implicit behavior but should be an
  explicit choice by the application. Signals are built to represent
  state. When an observable stream is converted to a stateful
  representation, there should be a choice made about what state should
  be presented when an error occurs
* If an error occurs but the signal value is never read in its error
  state, this is not an application state error that should result in an
  unhandled exception.
* While Angular does not have error boundaries today, there is likely to
  be investigation in the near future to address increased risk of
  errors thrown from signals such as this in templates. Without
  pre-designing any specifics, it is possible that this type of feature
  would require the error to be thrown from the signal. We are subsequently
  not prepared to commit to stabilizing the `toSignal` API with the
  `rejectErrors` option and its current behavior.

Developers that desire similar behavior to `rejectErrors` have several
options, the simplest of which would be something similar to
`toSignal(myStream.pipe(catchError(() => EMPTY)))`.

PR Close #60397
2025-03-18 14:10:24 +01:00
..
src fix(core): remove rejectErrors option encourages uncaught exceptions (#60397) 2025-03-18 14:10:24 +01:00
test fix(core): remove rejectErrors option encourages uncaught exceptions (#60397) 2025-03-18 14:10:24 +01:00
BUILD.bazel build: configure cross-pkg resolution for api extraction (#52499) 2024-01-05 11:27:34 -08:00
index.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
PACKAGE.md build(core): introduce @angular/core/rxjs-interop entrypoint (#49154) 2023-03-30 09:44:38 -07:00
public_api.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00