- All Implemented Interfaces:
Serializable,Comparable<HttpErrorCategory>,Constable
Essential HTTP error codes for resilient operations.
Provides minimal but sufficient error classification focused on actionable distinctions
needed for retry logic, monitoring, and error handling.
Design Principles
- Only includes error codes that require different handling
- Focuses on operational concerns rather than detailed HTTP semantics
- Enables effective retry and fallback strategies
Usage Pattern
HttpResultObject<String> result = httpHandler.load();
if (!result.isValid()) {
result.getErrorCode().ifPresent(code -> {
if (code.isRetryable()) {
scheduleRetry();
} else {
useFallback();
}
});
}
- Since:
- 1.0
- Author:
- Implementation for HTTP operations
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionClient-side errors (HTTP 4xx).Configuration or setup errors.Response content is invalid or unparseable.Network connectivity problems - timeouts, connection failures, etc.Server-side errors (HTTP 5xx). -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines if this error code represents a retryable condition.static HttpErrorCategoryReturns the enum constant of this class with the specified name.static HttpErrorCategory[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NETWORK_ERROR
Network connectivity problems - timeouts, connection failures, etc. Covers all transient network issues that may resolve with retry. -
SERVER_ERROR
Server-side errors (HTTP 5xx). Remote server problems that may be transient. -
CLIENT_ERROR
Client-side errors (HTTP 4xx). Request problems that typically require configuration changes. -
INVALID_CONTENT
Response content is invalid or unparseable. Covers all content validation failures including empty responses, malformed JSON, invalid JWKS, invalid well-known configs, etc. -
CONFIGURATION_ERROR
Configuration or setup errors. Invalid URLs, missing settings, SSL issues, authentication problems. Typically requires human intervention to resolve.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
isRetryable
Determines if this error code represents a retryable condition. Only network and server errors are typically transient and worth retrying.- Returns:
- true if the error condition is typically retryable
-