BUG-5280: unwrap RuntimeRequestExceptions
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / concepts / RequestException.java
index 5f525b0a9beb8e60174367f4798121d89a8200a6..4f2a0585da76c9afe04b0a5c744faf4c22138eba 100644 (file)
@@ -29,4 +29,14 @@ public abstract class RequestException extends Exception {
     }
 
     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;
+    }
 }