I am learning rxjava. If you do not pass in another onError
when using Action1
(onNext)
, if an exception is thrown, it will crash,
But usually I don’t care much about this onError
exception. Most of them write it just to avoid crashing and just see the exception information. But it is troublesome to write it every time, so I I just want to customize a Subscriber
similar to this
public static abstract class MySubscriber<T> extends Subscriber<T> {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
PtrCLog.e("MySubscriber", "onError: " + e.getMessage());
}
}
But if it is handled this way, if onError
is called, it cannot output which method or page it was triggered by. After thinking about it, there is no good way.
Could you please tell me if you have any good ideas? logcat
Can I output the method call stack?
仅有的幸福2017-05-16 13:30:44
This should be enough
Log.d(TAG, "your_msg", new Exception("mk_log"));