code: public static SystemException unwrapSystemException(Throwable throwable) {
          if (throwable == null) {
              return null;
          } else if (throwable instanceof SystemException) {
              return (SystemException) throwable;
          } else if (throwable.getCause() != null) {
              // recursive call to unwrap the cause
              return unwrapSystemException(throwable.getCause());
          } else {
              // didn't find any SystemException in the cause stack
              return null;
          }
      }
docs: Looks for SystemException in the cause chain.
  @return Found SystemException in the cause chain, or null if none found