code: public static boolean equal(final Throwable ex1, final Throwable ex2) {
          if (ex1 == ex2) {
              return true;
          }
          if (ex1 == null) {
              if (ex2 != null) {
                  return false;
              }
          } else if (ex2 == null) {
              if (ex1 != null) {
                  return false;
              }
          } else {
              if (ex1.getClass() != ex2.getClass()) {
                  return false;
              }
              if (ex1.getMessage() == null) {
                  if (ex2.getMessage() != null) {
                      return false;
                  }
              } else if (!ex1.getMessage().equals(ex2.getMessage())) {
                  return false;
              }
              if (!equal(ex1.getCause(), ex2.getCause())) {
                  return false;
              }
          }
          return true;
      }
docs: This is needed because Throwable doesn't override equals() and object
  equality is not what we want to test.
  
  @param ex1
  first Throwable
  @param ex2
  second Throwable
  @return true if the two arguments are equal, as we define it.