org.opendaylight.ocpplugin.impl.connection.ErrorHandlerSimpleImpl Maven / Gradle / Ivy
/*
* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.ocpplugin.impl.connection;
import java.util.Arrays;
import org.opendaylight.ocpplugin.api.ConnectionException;
import org.opendaylight.ocpplugin.api.ocp.connection.ErrorHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* dumping all exceptions to log
*/
public class ErrorHandlerSimpleImpl implements ErrorHandler {
private static final Logger LOG = LoggerFactory
.getLogger(ErrorHandlerSimpleImpl.class);
@Override
public void handleException(Throwable e) {
if (e instanceof ConnectionException) {
LOG.warn("exception -> {}", e.getMessage(), e);
} else {
LOG.error("exception -> {}", e.getMessage(), e);
}
}
}