Another round of ofp-impl warning fixes
[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 package org.opendaylight.openflowplugin.impl.connection;
9
10 import org.opendaylight.openflowplugin.api.ConnectionException;
11 import org.opendaylight.openflowplugin.api.openflow.md.core.ErrorHandler;
12 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory;
14
15 /**
16  * dumping all exceptions to log.
17  */
18 public class ErrorHandlerSimpleImpl implements ErrorHandler {
19
20     private static final Logger LOG = LoggerFactory
21             .getLogger(ErrorHandlerSimpleImpl.class);
22
23     @Override
24     public void handleException(Throwable throwable) {
25         if (throwable instanceof ConnectionException) {
26             LOG.warn("Exception", throwable);
27         } else {
28             LOG.error("Exception", throwable);
29         }
30     }
31 }