Description
From its Javadoc:
Represents a
Throwable
that anObservable
might notify its subscribers of, but that then can be handled by an operator that is designed to recover from or react appropriately to such an error.
From this description I was thinking that operators like onErrorResumeNext
might wrap emitted Throwables
in an OnErrorThrowable
instance using its from
static factory method, and then pass that OnErrorThrowable
instance to the global error handler. But the onError
method of OperatorOnErrorResumeNextViaFunction
looks like:
@Override
public void onError(Throwable e) {
if (done) {
Exceptions.throwIfFatal(e);
return;
}
done = true;
try {
RxJavaPlugins.getInstance().getErrorHandler().handleError(e);
...
And so the "raw" Throwable
is passed to the global error handler instead.
The problem we're trying to solve is this: the global error handler in our app forwards errors to Crashlytics. But we want to only forward Throwable
instances that we're not already recovering from by methods like onErrorResumeNext
. I was hoping that onErrorResumeNext
would wrap such errors in OnErrorThrowable
or something equivalent and our global error handler could only forward errors if they are not of this type.
Any thoughts on how we can achieve this behavior? Thanks!