Skip to content

Instantly share code, notes, and snippets.

@gautier-levert
Created March 1, 2018 13:57
Show Gist options
  • Save gautier-levert/11cafd088c28d943d0ebb16e60f5f50b to your computer and use it in GitHub Desktop.
Save gautier-levert/11cafd088c28d943d0ebb16e60f5f50b to your computer and use it in GitHub Desktop.
package com.google.common.eventbus;
import com.google.common.base.Throwables;
import java.lang.reflect.InvocationTargetException;
public class TestEventBus extends EventBus {
//If version 18 or bellow
@Override
void dispatch(Object event, EventSubscriber wrapper) {
try {
wrapper.handleEvent(event);
} catch (InvocationTargetException cause) {
Throwables.propagate(Throwables.getRootCause(cause));
}
}
//If version 19
@Override
public void handleSubscriberException(Throwable e, SubscriberExceptionContext context) {
Throwables.propagate(Throwables.getRootCause(e));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment