android - RxJava If using a custom observer, can the caller information be printed out in onError?
PHP中文网
PHP中文网 2017-05-16 13:28:44
0
1
544

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?

PHP中文网
PHP中文网

认证0级讲师

reply all(1)
仅有的幸福

This should be enough

Log.d(TAG, "your_msg", new Exception("mk_log"));
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template