regulators: Enhance exception utilities

Implement function that finds all exceptions within a nested exception
and returns them in a vector.

This function makes it easier to handle nested exceptions.  You can
iterate over them in a simple loop instead of writing recursive code.

The new function exists in the exception_utils namespace.

Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: I36b135584ec6024625a572bbe0522643406245cd
diff --git a/phosphor-regulators/src/exception_utils.hpp b/phosphor-regulators/src/exception_utils.hpp
index 81d700b..e90f0b6 100644
--- a/phosphor-regulators/src/exception_utils.hpp
+++ b/phosphor-regulators/src/exception_utils.hpp
@@ -30,6 +30,21 @@
 {
 
 /**
+ * Returns a vector containing the specified exception and any nested inner
+ * exceptions.
+ *
+ * If the exception contains nested inner exceptions, the returned vector will
+ * be ordered from innermost exception to outermost exception.
+ *
+ * This function makes it easier to handle nested exceptions.  You can iterate
+ * over them in a simple loop instead of writing a recursive function.
+ *
+ * @param eptr exception pointer
+ * @return vector of exceptions, from innermost to outermost
+ */
+std::vector<std::exception_ptr> getExceptions(std::exception_ptr eptr);
+
+/**
  * Gets the error messages from the specified exception and any nested inner
  * exceptions.
  *
@@ -49,6 +64,19 @@
 {
 
 /**
+ * Builds a vector containing the specified exception and any nested inner
+ * exceptions.
+ *
+ * Stores the exceptions in the specified vector, from innermost exception to
+ * outermost exception.
+ *
+ * @param eptr exception pointer
+ * @param exceptions vector where exceptions will be stored
+ */
+void getExceptions(std::exception_ptr eptr,
+                   std::vector<std::exception_ptr>& exceptions);
+
+/**
  * Gets the error messages from the specified exception and any nested inner
  * exceptions.
  *