Log errors in the eventbus

This commit is contained in:
Owain van Brakel
2019-07-14 14:06:58 +02:00
parent a25d553d3e
commit aca9ba969f

View File

@@ -10,7 +10,9 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@Singleton
public class EventBus implements EventBusInterface
{
@@ -43,7 +45,10 @@ public class EventBus implements EventBusInterface
Disposable disposable = getSubject(eventClass)
.filter(Objects::nonNull) // Filter out null objects, better safe than sorry
.cast(eventClass) // Cast it for easier usage
.subscribe(action);
.subscribe(action, error ->
{
log.error("Error in eventbus: {}", error.getMessage());
});
getCompositeDisposable(lifecycle).add(disposable);
}