Merge "Fix codestyle"
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / connection / ErrorHandlerSimpleImpl.java
1 /**
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.openflowplugin.impl.connection;
10
11 import org.opendaylight.openflowplugin.api.ConnectionException;
12 import org.opendaylight.openflowplugin.api.openflow.md.core.ErrorHandler;
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
15
16 /**
17  * dumping all exceptions to log
18  */
19 public class ErrorHandlerSimpleImpl implements ErrorHandler {
20
21     private static final Logger LOG = LoggerFactory
22             .getLogger(ErrorHandlerSimpleImpl.class);
23
24     @Override
25     public void handleException(Throwable e) {
26         if (e instanceof ConnectionException) {
27             LOG.warn("exception -> {}", e.getMessage(), e);
28         } else {
29             LOG.error("exception -> {}", e.getMessage(), e);
30         }
31     }
32 }