diff --git a/spotbugs-exclude.xml b/spotbugs-exclude.xml
index 4f06c788f..d8c83fb7b 100644
--- a/spotbugs-exclude.xml
+++ b/spotbugs-exclude.xml
@@ -252,9 +252,6 @@
-
-
-
diff --git a/src/main/java/com/thealgorithms/datastructures/heaps/EmptyHeapException.java b/src/main/java/com/thealgorithms/datastructures/heaps/EmptyHeapException.java
index f18e4d4a9..11af3f399 100644
--- a/src/main/java/com/thealgorithms/datastructures/heaps/EmptyHeapException.java
+++ b/src/main/java/com/thealgorithms/datastructures/heaps/EmptyHeapException.java
@@ -10,4 +10,8 @@ public class EmptyHeapException extends Exception {
public EmptyHeapException(String message) {
super(message);
}
+
+ public EmptyHeapException(String message, Throwable cause) {
+ super(message, cause);
+ }
}
diff --git a/src/main/java/com/thealgorithms/datastructures/heaps/MaxHeap.java b/src/main/java/com/thealgorithms/datastructures/heaps/MaxHeap.java
index faf9fb92e..4edf02679 100644
--- a/src/main/java/com/thealgorithms/datastructures/heaps/MaxHeap.java
+++ b/src/main/java/com/thealgorithms/datastructures/heaps/MaxHeap.java
@@ -123,7 +123,7 @@ public class MaxHeap implements Heap {
try {
return extractMax();
} catch (Exception e) {
- throw new EmptyHeapException("Heap is empty. Error retrieving element");
+ throw new EmptyHeapException("Heap is empty. Error retrieving element", e);
}
}
}
diff --git a/src/main/java/com/thealgorithms/datastructures/heaps/MinHeap.java b/src/main/java/com/thealgorithms/datastructures/heaps/MinHeap.java
index 288a1932d..f220fe492 100644
--- a/src/main/java/com/thealgorithms/datastructures/heaps/MinHeap.java
+++ b/src/main/java/com/thealgorithms/datastructures/heaps/MinHeap.java
@@ -117,7 +117,7 @@ public class MinHeap implements Heap {
try {
return extractMin();
} catch (Exception e) {
- throw new EmptyHeapException("Heap is empty. Error retrieving element");
+ throw new EmptyHeapException("Heap is empty. Error retrieving element", e);
}
}
}