class KubernetesCrudDispatcherException extends Exception {
  private final Integer code;
  private final String kind;
  private final String[] requiredFields;

  public KubernetesCrudDispatcherException(String message, Integer code) {
    this(message, code, null);
  }

  public KubernetesCrudDispatcherException(String message, Integer code, String kind, String... requiredFields) {
    super(message);
    this.code = code;
    this.kind = Utils.isNullOrEmpty(kind) ? "Unknown" : kind;
    this.requiredFields = requiredFields;
  }

  public int getCode() {
    return code == null ? HttpURLConnection.HTTP_BAD_REQUEST : code;
  }

  public Status toStatus() {
    return new StatusBuilder().withStatus("Failure")
        .withReason("Invalid")
        .withMessage(getMessage())
        .withNewDetails()
        .withKind(kind)
        .withCauses(Arrays.stream(requiredFields)
            .map(KubernetesCrudDispatcherException::toStatusCause).collect(Collectors.toList()))
        .endDetails()
        .withCode(getCode())
        .build();
  }

  public String toStatusBody() {
    return Serialization.asJson(toStatus());
  }

  private static StatusCause toStatusCause(String requiredField) {<FILL_FUNCTION_BODY>}

}

    return new StatusCauseBuilder()
        .withMessage("Required value: " + requiredField + " is required")
        .withReason("ValueRequired")
        .build();
  
<methods>public void <init>() ,public void <init>(java.lang.String) ,public void <init>(java.lang.Throwable) ,public void <init>(java.lang.String, java.lang.Throwable) <variables>static final long serialVersionUID