[NO ISSUE][HYR][FAIL][RT] Avoid wrapping Errors

Change-Id: I7bb47c036a58ac9d8cb2dc77391a17dd22df19ad
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1922
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksDataException.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksDataException.java
index 0a99ea6..2cf804e 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksDataException.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksDataException.java
@@ -36,8 +36,10 @@
     public static HyracksDataException create(Throwable cause) {
         if (cause instanceof HyracksDataException || cause == null) {
             return (HyracksDataException) cause;
-        }
-        if (cause instanceof InterruptedException && !Thread.currentThread().isInterrupted()) {
+        } else if (cause instanceof Error) {
+            // don't wrap errors, allow them to propagate
+            throw (Error)cause;
+        } else if (cause instanceof InterruptedException && !Thread.currentThread().isInterrupted()) {
             LOGGER.log(Level.WARNING,
                     "Wrapping an InterruptedException in HyracksDataException and current thread is not interrupted",
                     cause);