code: @Restricted(NoExternalUse.class)
      public static @Nonnull <T> T getNearestAncestorOfTypeOrThrow(@Nonnull StaplerRequest request, @Nonnull Class<T> clazz) {
          T t = request.findAncestorObject(clazz);
          if (t == null) {
              throw new IllegalArgumentException("No ancestor of type " + clazz.getName() + " in the request");
          }
          return t;
      }
docs: Find the specific ancestor, or throw an exception.
  Useful for an ancestor we know is inside the URL to ease readability