class CommandWithThrowableDrivenErrorCallback extends HasBusyIndicatorDefaultErrorCallback {

    @Override
    public boolean error(final Message message,
                         final Throwable throwable) {
        // The *real* Throwable is wrapped in an InvocationTargetException when ran as a Unit Test and invoked with Reflection.
        final Throwable _throwable = (throwable.getCause() == null ? throwable : throwable.getCause());
        for (Map.Entry<Class<? extends Throwable>, CommandWithThrowable> e : commands.entrySet()) {
            if (e.getKey().getName().equals(_throwable.getClass().getName())) {
                e.getValue().execute(_throwable);
                return false;
            }
        }

        if (defaultCommand != null) {
            defaultCommand.execute(throwable);
            return false;
        }

        return super.error(message, throwable);
    }

    public  CommandWithThrowableDrivenErrorCallback(final HasBusyIndicator view,
                                                   final Map<Class<? extends Throwable>, CommandWithThrowable> commands);
    public  CommandWithThrowableDrivenErrorCallback(final HasBusyIndicator view,
                                                   final Map<Class<? extends Throwable>, CommandWithThrowable> commands,
                                                   final CommandWithThrowable defaultCommand);
    public  CommandWithThrowableDrivenErrorCallback(HasBusyIndicator view, CommandWithThrowable defaultCommand);

}