BUG-3219: Fix OutboundQueue request error reporting
[openflowjava.git] / openflow-protocol-api / src / main / java / org / opendaylight / openflowjava / protocol / api / connection / DeviceRequestFailedException.java
1 /*
2  * Copyright (c) 2015 Pantheon Technologies s.r.o. 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.openflowjava.protocol.api.connection;
9
10 import com.google.common.base.Preconditions;
11 import javax.annotation.Nonnull;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.Error;
13
14 /**
15  * Exception which is used to report that a particular request failed on the
16  * remote device (switch).
17  */
18 public class DeviceRequestFailedException extends Exception {
19     private static final long serialVersionUID = 1L;
20     private final Error error;
21
22     public DeviceRequestFailedException(final String message, @Nonnull final Error error) {
23         super(message);
24         this.error = Preconditions.checkNotNull(error);
25     }
26
27     public DeviceRequestFailedException(final String message, @Nonnull final Error error, final Throwable cause) {
28         super(message, cause);
29         this.error = Preconditions.checkNotNull(error);
30     }
31
32     @Nonnull public Error getError() {
33         return error;
34     }
35 }