I have a stream implemented using Rxjs which may fail, and in the case that it does, I need the stream to close and to be able to handle the error for a graceful shutdown.
The error
callback in the subscribe method does everything I want, but rxjs has built-in error reporting which I would like to suppress so that my code can handle this with more intentionality.
IIRC, the catchError
operator would suppress this logging but it keeps the stream alive and would complicate dependent code as I would have to pipe out error information differently to trigger my error handling code elsewhere.
Is there a straight-forward way to suppress unhandled exception logging for rxjs while avoiding use of catchError
so that I can handle error reporting my own way in the subscribe method's error
callback?
Edit: as it turns out the situation was a little more serious than unnecessary logging. The pipeline was throwing exceptions asynchronously which could not be caught at top-level code, and were crashing the program before cleanup operations could complete. While ideally I would prefer to rely on the error callback in this scenario, I opted to fall back to the catchError operator used in a dependency prior to subscription, to prevent application crashes.
I'm leaving this question open for now in case anyone has a better answer.