Class ValidationException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
ai.docling.serve.api.validation.ValidationException
All Implemented Interfaces:
Serializable

public class ValidationException extends RuntimeException
Represents an exception that is thrown when validation errors occur. This exception is designed to encapsulate structured validation error details represented by a ValidationError object. It can provide additional context through an optional message and an optional cause. It extends RuntimeException, making it an unchecked exception.
See Also:
  • Constructor Details

    • ValidationException

      public ValidationException(@Nullable ValidationError validationError)
      Constructs a new ValidationException with the specified ValidationError. This constructor allows the exception to encapsulate a ValidationError object for providing detailed information about the validation error that occurred. This instance does not include an additional custom message or cause.
      Parameters:
      validationError - the ValidationError containing validation error details, or null if no specific validation error details are provided.
    • ValidationException

      public ValidationException(@Nullable ValidationError validationError, @Nullable Throwable cause)
      Constructs a new ValidationException with the specified ValidationError and cause. This constructor allows the exception to encapsulate a ValidationError object for providing detailed information about the validation error that occurred, along with an optional cause for contextual information about the exception's origin.
      Parameters:
      validationError - the ValidationError containing validation error details, or null if no specific validation error details are provided.
      cause - the Throwable cause of this exception, or null if no underlying cause is to be associated with this exception.
    • ValidationException

      public ValidationException(@Nullable ValidationError validationError, @Nullable String message)
      Constructs a new ValidationException with the specified ValidationError and message. This constructor allows the exception to encapsulate a ValidationError object for providing detailed information about the validation error that occurred, along with an optional custom message describing the error context.
      Parameters:
      validationError - the ValidationError containing validation error details, or null if no specific validation error details are provided.
      message - the custom message for the exception, or null if no custom message is to be associated with this exception.
    • ValidationException

      public ValidationException(@Nullable ValidationError validationError, @Nullable Throwable cause, @Nullable String message)
      Constructs a new ValidationException with the specified ValidationError, cause, and message. This constructor allows the exception to encapsulate a ValidationError object for providing detailed information about the validation error that occurred, along with an optional cause and custom message for additional contextual details regarding the exception.
      Parameters:
      validationError - the ValidationError containing validation error details, or null if no specific validation error details are provided.
      cause - the Throwable cause of this exception, or null if no underlying cause is to be associated with this exception.
      message - the custom message for the exception, or null if no custom message is to be associated with this exception.
  • Method Details

    • getValidationError

      public @Nullable ValidationError getValidationError()
      Retrieves the ValidationError associated with this exception. This method returns the encapsulated ValidationError that contains detailed information about the validation error. If no specific validation error information is available, this method may return null.
      Returns:
      the ValidationError associated with this exception, or null if no validation error details are provided.