Search code examples
androidgreenrobot-eventbus

GreenRobot EventBus crash app


I use GreenRobot's EventBus all over my app and love it. When I use a method like

public void onEventMainThread(SearchStartedEvent e) {

    doThis();

}

and in doThis() there is an Exception like a NPE, the App won't crash but EventBus will Log.e() the exception. Can I configure EventBus so it will actually crash my App? That would make debugging easier for me.


Solution

  • Instance of SubscriberExceptionEvent is posted by EventBus when an exception occurs inside a subscriber's event handling method. You can implement method

    public void onEvent(SubscriberExceptionEvent exceptionEvent) {
         yourHandlingMethod(exceptionEvent.throwable);
    }
    

    and handle any thrown exception.