Package com.google.genkit.core
Class GenkitException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.google.genkit.core.GenkitException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
SessionContext.SessionException
GenkitException is the base exception for all Genkit errors. It provides structured error
information including error codes and details.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for GenkitException. -
Constructor Summary
ConstructorsConstructorDescriptionGenkitException(String message) Creates a new GenkitException.GenkitException(String message, Throwable cause) Creates a new GenkitException with a cause.Creates a new GenkitException with full details. -
Method Summary
Modifier and TypeMethodDescriptionstatic GenkitException.Builderbuilder()Creates a builder for GenkitException.Returns additional error details.Returns the error code.Returns the trace ID for this error.voidsetTraceId(String traceId) Sets the trace ID for this error if it has not already been set.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
GenkitException
Creates a new GenkitException.- Parameters:
message- the error message
-
GenkitException
Creates a new GenkitException with a cause.- Parameters:
message- the error messagecause- 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 messagecause- the underlying causeerrorCode- the error codedetails- additional error detailstraceId- the trace ID for debugging
-
-
Method Details
-
getErrorCode
Returns the error code.- Returns:
- the error code, or null if not set
-
getDetails
Returns additional error details.- Returns:
- the error details, or null if not set
-
getTraceId
Returns the trace ID for this error.- Returns:
- the trace ID, or null if not set
-
setTraceId
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
Creates a builder for GenkitException.- Returns:
- a new builder
-