I use RxJS and I need to return an observable of that type im my method: Observable<MyStuff>
When I want to throw an error I use:
import { throwError } from "rxjs";
/// ... stuff
return throwError('Error stuff invalid');
throwError return an Observable<never> and it's not the same type as Observable<MyStuff>
I want to throw an error with that type: Observable<MyStuff>
I don't want to change the return type of my function if it's possible
What is the best practice to handle error with observables ?
Observable<MyStuff>?