Class TokenPlatformException
java.lang.Object
java.lang.Throwable
java.lang.Exception
io.confluent.kafka.odyssey.auth.TokenPlatformException
- All Implemented Interfaces:
Serializable
Exception thrown when Token Platform operations fail.
This exception includes an TokenPlatformException.ErrorType to help callers determine
appropriate error handling strategies:
TokenPlatformException.ErrorType.TRANSIENT: Temporary failures that may succeed on retry (e.g., network timeouts, service unavailable)TokenPlatformException.ErrorType.PERMANENT: Failures that will not succeed on retry (e.g., invalid credentials, permission denied)TokenPlatformException.ErrorType.CONFIGURATION: Configuration errors that require fixing (e.g., invalid URL, missing SPIRE agent)
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumCategorizes the type of error for appropriate handling. -
Constructor Summary
ConstructorsConstructorDescriptionTokenPlatformException(String message, TokenPlatformException.ErrorType errorType) Creates a new TokenPlatformException.TokenPlatformException(String message, Throwable cause, TokenPlatformException.ErrorType errorType) Creates a new TokenPlatformException with a cause.TokenPlatformException(String message, Throwable cause, TokenPlatformException.ErrorType errorType, String grpcStatusCode) Creates a new TokenPlatformException with gRPC status information. -
Method Summary
Modifier and TypeMethodDescriptionstatic TokenPlatformExceptionauthenticationError(String message, Throwable cause) Creates an exception for authentication/permission failures.static TokenPlatformExceptionconfigurationError(String message) Creates an exception for configuration problems without a cause.static TokenPlatformExceptionconfigurationError(String message, Throwable cause) Creates an exception for configuration problems.Returns the error type for handling decisions.Returns the gRPC status code if available.booleanReturns whether this error is a configuration issue.booleanReturns whether this error is permanent and will not succeed on retry.booleanReturns whether this error is transient and may succeed on retry.static TokenPlatformExceptionnetworkError(String message, Throwable cause) Creates an exception for network/connectivity issues.toString()Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Constructor Details
-
TokenPlatformException
Creates a new TokenPlatformException.- Parameters:
message- the error messageerrorType- the type of error for handling decisions
-
TokenPlatformException
public TokenPlatformException(String message, Throwable cause, TokenPlatformException.ErrorType errorType) Creates a new TokenPlatformException with a cause.- Parameters:
message- the error messagecause- the underlying causeerrorType- the type of error for handling decisions
-
TokenPlatformException
public TokenPlatformException(String message, Throwable cause, TokenPlatformException.ErrorType errorType, String grpcStatusCode) Creates a new TokenPlatformException with gRPC status information.- Parameters:
message- the error messagecause- the underlying causeerrorType- the type of error for handling decisionsgrpcStatusCode- the gRPC status code (e.g., "UNAVAILABLE", "PERMISSION_DENIED")
-
-
Method Details
-
getErrorType
Returns the error type for handling decisions.- Returns:
- the error type
-
getGrpcStatusCode
Returns the gRPC status code if available.- Returns:
- the gRPC status code, or null if not a gRPC error
-
isTransient
public boolean isTransient()Returns whether this error is transient and may succeed on retry.- Returns:
- true if the error is transient
-
isPermanent
public boolean isPermanent()Returns whether this error is permanent and will not succeed on retry.- Returns:
- true if the error is permanent
-
isConfiguration
public boolean isConfiguration()Returns whether this error is a configuration issue.- Returns:
- true if the error is a configuration problem
-
toString
-
networkError
Creates an exception for network/connectivity issues.- Parameters:
message- the error messagecause- the underlying cause- Returns:
- a transient exception
-
authenticationError
Creates an exception for authentication/permission failures.- Parameters:
message- the error messagecause- the underlying cause- Returns:
- a permanent exception
-
configurationError
Creates an exception for configuration problems.- Parameters:
message- the error messagecause- the underlying cause- Returns:
- a configuration exception
-
configurationError
Creates an exception for configuration problems without a cause.- Parameters:
message- the error message- Returns:
- a configuration exception
-