code: private int getMatchedDepth(String exceptionType, Throwable ex) {
          Throwable t = ex.getCause();
          if (t != null) {
              return getMatchedDepth(exceptionType, t);
          } else {
              return getMatchedDepth(exceptionType, ex.getClass(), 0);
          }
      }
docs: Returns the matched depth.
  
  @param exceptionType the exception type
  @param ex the throwable exception
  @return the matched depth