Merge "Use String(byte[], Charset)"
[openflowplugin.git] / openflowjava / 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 static java.util.Objects.requireNonNull;
11
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.Error;
14
15 /**
16  * Exception which is used to report that a particular request failed on the
17  * remote device (switch).
18  */
19 public class DeviceRequestFailedException extends OutboundQueueException {
20     private static final long serialVersionUID = 1L;
21     private final transient Error error;
22
23     public DeviceRequestFailedException(final String message, @NonNull final Error error) {
24         super(message);
25         this.error = requireNonNull(error);
26     }
27
28     public DeviceRequestFailedException(final String message, @NonNull final Error error, final Throwable cause) {
29         super(message, cause);
30         this.error = requireNonNull(error);
31     }
32
33     @NonNull public Error getError() {
34         return error;
35     }
36 }