*/
package org.opendaylight.controller.cluster.access.concepts;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
/**
* A failure cause behind a {@link RequestFailure} to process a {@link Request}.
public abstract class RequestException extends Exception {
private static final long serialVersionUID = 1L;
- protected RequestException(final @Nonnull String message) {
- super(Preconditions.checkNotNull(message));
+ protected RequestException(final @NonNull String message) {
+ super(requireNonNull(message));
}
- protected RequestException(final @Nonnull String message, final @Nonnull Exception cause) {
- super(Preconditions.checkNotNull(message), Preconditions.checkNotNull(cause));
+ protected RequestException(final @NonNull String message, final @NonNull Throwable cause) {
+ super(requireNonNull(message), requireNonNull(cause));
}
public abstract boolean isRetriable();
+
+ /**
+ * Unwraps the underlying failure. This method is overridden only in {@link RuntimeRequestException}.
+ *
+ * @return Underlying cause of the failure if exception is a {@link RuntimeRequestException}, or the exception
+ * itself.
+ */
+ public Throwable unwrap() {
+ return this;
+ }
}