Example usage for com.google.common.eventbus SubscriberExceptionHandler handleException

List of usage examples for com.google.common.eventbus SubscriberExceptionHandler handleException

Introduction

In this page you can find the example usage for com.google.common.eventbus SubscriberExceptionHandler handleException.

Prototype

void handleException(Throwable exception, SubscriberExceptionContext context);

Source Link

Document

Handles exceptions thrown by subscribers.

Usage

From source file:net.minecraftforge.fml.common.eventhandler.FMLThrowingEventBus.java

public FMLThrowingEventBus(final SubscriberExceptionHandler exceptionHandler) {
    super((exception, context) -> {
        try {//from  w  w  w.  ja va  2 s  .  c  o m
            exceptionHandler.handleException(exception, context);
        } catch (final Throwable t) {
            // this is a hack to break out of the catch statement in EventBus.handleSubscriberException
            throw new RuntimeException() {
                @Override
                public String toString() {
                    throw t;
                }
            };
        }
    });
}