Unclear solution to throwError deprecation #7532
Martinspire
started this conversation in
Report issues other than bug
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So for Angular httpClient I have used a few catchError items to handle various problems with the data from my API.
With my unit tests I have used throwError to test my logic.
But recently I've started to see deprecation messages around throwError and I can't figure out what syntax I'm supposed to use now because its not clear what the error is referring to.
In this block of code the message in VSCode is as follows:
Deprecated: The
scheduler
parameter will be removed in v8.Use
throwError
in combination with {@link observeOn}:throwError(() => new Error('test')).pipe(observeOn(scheduler));
.Details: https://rxjs.dev/deprecations/scheduler-argument
I'm using eslint to spot these deprecations, but I don't really get why I suddenly need a pipe and what the heck to put in the observer. The scheduler parameter will be removed message is throwing me off because I'm not adding a scheduler. I'm just adding my mock as a return since that was already needed for the previous deprecation of throwError (which was also a bit unclear in the messaging, but I got it going).
Beta Was this translation helpful? Give feedback.
All reactions