Class LlmInvocationException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
FakeResponseNotFoundException

public class LlmInvocationException extends RuntimeException
Thrown when an LLM request fails due to network issues, HTTP errors, invalid responses, or provider-specific validation failures.

Not final: providers may define specific subtypes (for example a scripted provider's "no response for this key" failure) so callers can catch the provider-neutral type while still distinguishing the cause. A subtype with no HTTP status is treated as non-transient by consumers that implement retry logic.

See Also:
  • Constructor Details

    • LlmInvocationException

      public LlmInvocationException(String message)
      Creates a new exception with the given message.
      Parameters:
      message - a description of the failure
    • LlmInvocationException

      public LlmInvocationException(String message, Throwable cause)
      Creates a new exception with the given message and cause.
      Parameters:
      message - a description of the failure
      cause - the underlying exception
    • LlmInvocationException

      public LlmInvocationException(String message, int httpStatus)
      Creates a new exception with the given message and HTTP status from the provider response.
      Parameters:
      message - a description of the failure
      httpStatus - HTTP status code when the failure was triggered by an HTTP response
  • Method Details

    • getHttpStatus

      public Integer getHttpStatus()
      Returns the HTTP status code associated with this exception, if applicable.
      Returns:
      the HTTP status code, or null if not applicable