Search in sources :

Example 1 with ErrorEvent

use of won.bot.framework.eventbot.event.impl.lifecycle.ErrorEvent in project webofneeds by researchstudio-sat.

the class BaseEventBotAction method getActionTask.

@Override
public Runnable getActionTask(final Event event, final EventListener eventListener) {
    return new Runnable() {

        public void run() {
            Stopwatch stopwatch = SimonManager.getStopwatch(stopwatchName);
            Split split = stopwatch.start();
            try {
                doRun(event, eventListener);
                split.stop();
            } catch (Exception e) {
                eventListenerContext.getEventBus().publish(new ErrorEvent(e));
                split.stop(EXCEPTION_TAG);
            } catch (Throwable t) {
                logger.warn("could not run action {}", stopwatchName, t);
                split.stop(EXCEPTION_TAG);
                throw t;
            }
        }
    };
}
Also used : Stopwatch(org.javasimon.Stopwatch) ErrorEvent(won.bot.framework.eventbot.event.impl.lifecycle.ErrorEvent) Split(org.javasimon.Split)

Aggregations

Split (org.javasimon.Split)1 Stopwatch (org.javasimon.Stopwatch)1 ErrorEvent (won.bot.framework.eventbot.event.impl.lifecycle.ErrorEvent)1