Class GenkitException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
SessionContext.SessionException

public class GenkitException extends RuntimeException
GenkitException is the base exception for all Genkit errors. It provides structured error information including error codes and details.
See Also:
  • Constructor Details

    • GenkitException

      public GenkitException(String message)
      Creates a new GenkitException.
      Parameters:
      message - the error message
    • GenkitException

      public GenkitException(String message, Throwable cause)
      Creates a new GenkitException with a cause.
      Parameters:
      message - the error message
      cause - the underlying cause
    • GenkitException

      public GenkitException(String message, Throwable cause, String errorCode, Object details, String traceId)
      Creates a new GenkitException with full details.
      Parameters:
      message - the error message
      cause - the underlying cause
      errorCode - the error code
      details - additional error details
      traceId - the trace ID for debugging
  • Method Details

    • getErrorCode

      public String getErrorCode()
      Returns the error code.
      Returns:
      the error code, or null if not set
    • getDetails

      public Object getDetails()
      Returns additional error details.
      Returns:
      the error details, or null if not set
    • getTraceId

      public String getTraceId()
      Returns the trace ID for this error.
      Returns:
      the trace ID, or null if not set
    • setTraceId

      public void setTraceId(String traceId)
      Sets the trace ID for this error if it has not already been set. This is intended to be used by tracing infrastructure to attach the active trace ID when an exception propagates out of a span, without losing the exception's runtime type.
      Parameters:
      traceId - the trace ID to associate with this exception
    • builder

      public static GenkitException.Builder builder()
      Creates a builder for GenkitException.
      Returns:
      a new builder