Skip to content

OnErrorNotImplementedException is not fatal for CalledFromWrongThreadException #28

Closed
@dlew

Description

@dlew

If onError() is called and you don't have an onError() defined, OnErrorNotImplementedException should get thrown and crash your program. However, there's one case in Android where this doesn't seem to happen, and I'm having a hard time figuring out why that's the case.

Here's some short example code which should cause an app to crash, but doesn't:

Observable.just(null)
    .delay(1, TimeUnit.SECONDS)
    .observeOn(Schedulers.io())
    .subscribe(__ -> someView.setBackgroundColor(Color.RED));

I've been trying to figure out why this exception gets consumed; normally if the Subscriber throws an Exception but has no error handling it will crash the app. But in this case, CalledFromWrongThreadException gets thrown and ignored. This leads to a lot of sadness because it can cause all sorts of weird interactions (since normally this is a fatal, unrecoverable issue on Android).

It may ultimately be an RxJava based problem, but I can't reproduce it outside of the context of CalledFromWrongThreadException. Any ideas on what's going on?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions