Enum Class IServiceStatusListener.ErrorType
java.lang.Object
java.lang.Enum<IServiceStatusListener.ErrorType>
co.mindus.ip2location.IServiceStatusListener.ErrorType
- All Implemented Interfaces:
Serializable, Comparable<IServiceStatusListener.ErrorType>, Constable
- Enclosing interface:
IServiceStatusListener
Categories of errors that can occur in the IP2Location service.
These error types are used in IServiceStatusListener.onError(ErrorType, String, Throwable) to classify the nature of the error for appropriate handling.
- Author:
- Christopher Mindus
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E>Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionDatabase file format is invalid or corrupted.Lookup failed due to database error.Memory allocation failed when loading database.Database file is missing (expected but not found).ZIP file extraction failed (corrupted archive, missing BIN file).HTTP error response (4xx or 5xx status codes).Network connection failed (timeout, unreachable host, etc.).Proxy connection or authentication failed.Download token is invalid, expired, or unauthorized.Database directory does not exist and cannot be created.Cannot read database file (permissions, file locked).State file is corrupted or cannot be read/written.Cannot write to the database directory (permissions, disk full).Automatic recovery was attempted but failed.Service initialization failed.Service reconfiguration failed.Unknown or unclassified error.Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether this error type is recoverable by clearing the database directory and re-downloading.booleanReturns whether this error type is transient and may resolve on retry (e.g., network issues, server errors).booleanReturns whether this error type requires user intervention (e.g., updating token, fixing permissions).Returns the enum constant of this class with the specified name.static IServiceStatusListener.ErrorType[]values()Returns an array containing the constants of this enum class, in the order they are declared.
Enum Constant Details
DOWNLOAD_NETWORK_ERROR
Network connection failed (timeout, unreachable host, etc.).DOWNLOAD_HTTP_ERROR
HTTP error response (4xx or 5xx status codes).Common cases:
- 401 - Invalid or missing token
- 403 - Token expired or account suspended
- 404 - Database type not available
- 429 - Rate limited
- 5xx - Server errors
DOWNLOAD_TOKEN_ERROR
Download token is invalid, expired, or unauthorized.This is a specific case of HTTP error that indicates the token needs to be updated.
DOWNLOAD_PROXY_ERROR
Proxy connection or authentication failed.DOWNLOAD_EXTRACTION_ERROR
ZIP file extraction failed (corrupted archive, missing BIN file).FILESYSTEM_WRITE_ERROR
Cannot write to the database directory (permissions, disk full).FILESYSTEM_READ_ERROR
Cannot read database file (permissions, file locked).FILESYSTEM_DIRECTORY_ERROR
Database directory does not exist and cannot be created.FILESYSTEM_STATE_ERROR
State file is corrupted or cannot be read/written.DATABASE_CORRUPT
Database file format is invalid or corrupted.DATABASE_MISSING
Database file is missing (expected but not found).DATABASE_MEMORY_ERROR
Memory allocation failed when loading database.This can occur with memory-mapped files or when loading large databases into heap memory.
DATABASE_LOOKUP_ERROR
Lookup failed due to database error.This indicates the database may be corrupted and recovery might be needed.
SERVICE_INIT_ERROR
Service initialization failed.SERVICE_RECONFIG_ERROR
Service reconfiguration failed.RECOVERY_FAILED
Automatic recovery was attempted but failed.UNKNOWN
Unknown or unclassified error.
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
isRecoverable
public boolean isRecoverable()Returns whether this error type is recoverable by clearing the database directory and re-downloading.- Returns:
trueif recovery might help
requiresUserAction
public boolean requiresUserAction()Returns whether this error type requires user intervention (e.g., updating token, fixing permissions).- Returns:
trueif user action is required
isTransient
public boolean isTransient()Returns whether this error type is transient and may resolve on retry (e.g., network issues, server errors).- Returns:
trueif the error might be transient