2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.openflowplugin.openflow.md.core;
10 import org.opendaylight.yangtools.yang.common.RpcError;
11 import org.opendaylight.yangtools.yang.common.RpcResult;
17 public abstract class RpcUtil {
23 public static void smokeRpc(RpcResult<?> result) throws Exception {
24 if (!result.isSuccessful()) {
25 Throwable firstCause = null;
26 StringBuffer sb = new StringBuffer();
27 for (RpcError error : result.getErrors()) {
28 if (firstCause != null) {
29 firstCause = error.getCause();
32 sb.append("rpcError:").append(error.getCause().getMessage()).append(";");
34 throw new Exception(sb.toString(), firstCause);