/*
 * Copyright (c) 2006-2015 DMDirc Developers
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package com.dmdirc;

import com.dmdirc.events.DMDircEvent;

import net.engio.mbassy.bus.MBassador;
import net.engio.mbassy.bus.config.BusConfiguration;
import net.engio.mbassy.bus.config.Feature;

/**
 * Generified MBassador.
 */
public class DMDircMBassador extends MBassador<DMDircEvent> {

    public DMDircMBassador() {
        super(new BusConfiguration()
                .addFeature(Feature.SyncPubSub.Default())
                .addFeature(Feature.AsynchronousHandlerInvocation.Default(1, 1))
                .addFeature(Feature.AsynchronousMessageDispatch.Default()
                        .setNumberOfMessageDispatchers(1)));
    }

    public DMDircMBassador(final BusConfiguration configuration) {
        super(configuration);
    }
}

@@ -1167,27 +1167,104 @@
 .events.
-DMDircEvent
+AppErrorEvent;%0Aimport com.dmdirc.events.DMDircEvent;%0Aimport com.dmdirc.logger.ErrorLevel
 ;%0A%0Aimpor
@@ -1558,33 +1558,16 @@
 ration()
-%0A                
 .addFeat
@@ -1680,16 +1680,28 @@
 t(1, 1))
+.addFeature(
 %0A       
@@ -1705,36 +1705,32 @@
             
-.addFeature(
+        
 Feature.Asyn
@@ -1787,16 +1787,24 @@
         
+        
 .setNumb
@@ -1832,16 +1832,45 @@
 s(1)));%0A
+        setupErrorHandler();%0A
     %7D%0A%0A 
@@ -1965,16 +1965,229 @@
 ation);%0A
+        setupErrorHandler();%0A    %7D%0A%0A    private void setupErrorHandler() %7B%0A        addErrorHandler(error -%3E publish(%0A                new AppErrorEvent(ErrorLevel.HIGH, error.getCause(), error.getMessage(), %22%22)));%0A
     %7D%0A%7D%0A

Add error logging to the event bus.