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

public static enum IServiceStatusListener.ErrorType extends Enum<IServiceStatusListener.ErrorType>
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
  • Enum Constant Details

    • DOWNLOAD_NETWORK_ERROR

      public static final IServiceStatusListener.ErrorType DOWNLOAD_NETWORK_ERROR
      Network connection failed (timeout, unreachable host, etc.).
    • DOWNLOAD_HTTP_ERROR

      public static final IServiceStatusListener.ErrorType 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

      public static final IServiceStatusListener.ErrorType 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

      public static final IServiceStatusListener.ErrorType DOWNLOAD_PROXY_ERROR
      Proxy connection or authentication failed.
    • DOWNLOAD_EXTRACTION_ERROR

      public static final IServiceStatusListener.ErrorType DOWNLOAD_EXTRACTION_ERROR
      ZIP file extraction failed (corrupted archive, missing BIN file).
    • FILESYSTEM_WRITE_ERROR

      public static final IServiceStatusListener.ErrorType FILESYSTEM_WRITE_ERROR
      Cannot write to the database directory (permissions, disk full).
    • FILESYSTEM_READ_ERROR

      public static final IServiceStatusListener.ErrorType FILESYSTEM_READ_ERROR
      Cannot read database file (permissions, file locked).
    • FILESYSTEM_DIRECTORY_ERROR

      public static final IServiceStatusListener.ErrorType FILESYSTEM_DIRECTORY_ERROR
      Database directory does not exist and cannot be created.
    • FILESYSTEM_STATE_ERROR

      public static final IServiceStatusListener.ErrorType FILESYSTEM_STATE_ERROR
      State file is corrupted or cannot be read/written.
    • DATABASE_CORRUPT

      public static final IServiceStatusListener.ErrorType DATABASE_CORRUPT
      Database file format is invalid or corrupted.
    • DATABASE_MISSING

      public static final IServiceStatusListener.ErrorType DATABASE_MISSING
      Database file is missing (expected but not found).
    • DATABASE_MEMORY_ERROR

      public static final IServiceStatusListener.ErrorType 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

      public static final IServiceStatusListener.ErrorType DATABASE_LOOKUP_ERROR
      Lookup failed due to database error.

      This indicates the database may be corrupted and recovery might be needed.

    • SERVICE_INIT_ERROR

      public static final IServiceStatusListener.ErrorType SERVICE_INIT_ERROR
      Service initialization failed.
    • SERVICE_RECONFIG_ERROR

      public static final IServiceStatusListener.ErrorType SERVICE_RECONFIG_ERROR
      Service reconfiguration failed.
    • RECOVERY_FAILED

      public static final IServiceStatusListener.ErrorType RECOVERY_FAILED
      Automatic recovery was attempted but failed.
    • UNKNOWN

      public static final IServiceStatusListener.ErrorType UNKNOWN
      Unknown or unclassified error.
  • Method Details

    • values

      public static IServiceStatusListener.ErrorType[] 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

      public static IServiceStatusListener.ErrorType valueOf(String name)
      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 name
      NullPointerException - 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:
      true if recovery might help
    • requiresUserAction

      public boolean requiresUserAction()
      Returns whether this error type requires user intervention (e.g., updating token, fixing permissions).
      Returns:
      true if 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:
      true if the error might be transient