# Enum HealthError

java.lang.Object
java.lang.Enum<HealthError>
com.codename1.health.HealthError

All Implemented Interfaces:
  `Comparable<HealthError>`

public enum HealthError extends Enum<HealthError>
Typed failure reasons carried by `HealthException`. Ports map their platform error codes onto these so cross-platform code can branch on a stable value instead of parsing messages.

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `ANCHOR_EXPIRED`
  A stored anchor or change token was rejected by the platform, usually because it aged out.
  `DATABASE_INACCESSIBLE`
  The platform's health database could not be opened.
  `INVALID_ARGUMENT`
  A query or write was rejected before reaching the platform because the request itself was malformed -- an inverted time range, an instantaneous write of a cumulative type, a negative limit.
  `INVALID_DATA`
  A payload could not be decoded -- a truncated or malformed GATT characteristic value, or a platform record the port could not map.
  `NOT_SUPPORTED`
  The port, device or OS version has no health support at all, or the requested capability is unavailable on this platform.
  `PROVIDER_UNAVAILABLE`
  The Health Connect provider app is not installed.
  `PROVIDER_UPDATE_REQUIRED`
  The installed Health Connect provider is too old.
  `QUOTA_EXCEEDED`
  The operation would return or write more data than the platform permits in one call.
  `RATE_LIMITED`
  The platform rate-limited the request.
  `SENSOR_DISCONNECTED`
  A live BLE sensor dropped its connection mid-session.
  `SESSION_STATE`
  A workout session method was called in a state that does not allow it -- pausing a session that never started, ending one twice.
  `TIMEOUT`
  The operation did not complete within its safety timeout.
  `TYPE_NOT_SUPPORTED`
  The requested data type is not available on this platform, even though health support in general is.
  `UNAUTHORIZED`
  The operation was refused for lack of authorization.
  `UNIT_MISMATCH`
  A unit was supplied that measures a different dimension than the data type requires.
  `UNKNOWN`
  Anything the port could not classify.
  `USER_CANCELED`
  The user dismissed a platform authorization or setup flow.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static HealthError`
  `valueOf(String name)`
  Returns the enum constant of this type with the specified name.
  `static HealthError[]`
  `values()`
  Returns an array containing the constants of this enum type, in the order they are declared.

  ### Methods inherited from class Enum

  `clone, compareTo, equals, getDeclaringClass, getEnumValues, hashCode, name, ordinal, setEnumValues, toString, valueOf`

  ### Methods inherited from class Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Enum Constant Details

  - ### NOT_SUPPORTED

    public static final HealthError NOT_SUPPORTED
    The port, device or OS version has no health support at all, or the requested capability is unavailable on this platform. Returned by every operation on the fallback `Health` base class.

  - ### TYPE_NOT_SUPPORTED

    public static final HealthError TYPE_NOT_SUPPORTED
    The requested data type is not available on this platform, even though health support in general is.

  - ### PROVIDER_UNAVAILABLE

    public static final HealthError PROVIDER_UNAVAILABLE
    The Health Connect provider app is not installed. Recoverable by sending the user to `Health.openProviderSetup()`.

  - ### PROVIDER_UPDATE_REQUIRED

    public static final HealthError PROVIDER_UPDATE_REQUIRED
    The installed Health Connect provider is too old. Also recoverable via `Health.openProviderSetup()`.

  - ### UNAUTHORIZED

    public static final HealthError UNAUTHORIZED

    The operation was refused for lack of authorization.

    Note that a read denial does not reliably produce this error: HealthKit reports a denied read as an empty result, by design. See `HealthStore.getReadAuthorizationStatus(HealthDataType)`.

  - ### USER_CANCELED

    public static final HealthError USER_CANCELED
    The user dismissed a platform authorization or setup flow. Only reported where the platform distinguishes cancellation from denial.

  - ### INVALID_ARGUMENT

    public static final HealthError INVALID_ARGUMENT
    A query or write was rejected before reaching the platform because the request itself was malformed -- an inverted time range, an instantaneous write of a cumulative type, a negative limit.

  - ### UNIT_MISMATCH

    public static final HealthError UNIT_MISMATCH
    A unit was supplied that measures a different dimension than the data type requires.

  - ### INVALID_DATA

    public static final HealthError INVALID_DATA
    A payload could not be decoded -- a truncated or malformed GATT characteristic value, or a platform record the port could not map. Never surfaces as an unchecked exception from a parser.

  - ### DATABASE_INACCESSIBLE

    public static final HealthError DATABASE_INACCESSIBLE
    The platform's health database could not be opened. On iOS this is `HKErrorDatabaseInaccessible`, raised while the device is locked -- which is exactly when a background observer fires. Retryable: callers should try again once the device is unlocked rather than treating it as "no data".

  - ### ANCHOR_EXPIRED

    public static final HealthError ANCHOR_EXPIRED
    A stored anchor or change token was rejected by the platform, usually because it aged out. The caller must resynchronize with a full time-range read; see `HealthChangeBatch.isResyncRequired()`.

  - ### QUOTA_EXCEEDED

    public static final HealthError QUOTA_EXCEEDED
    The operation would return or write more data than the platform permits in one call. Use paging or a smaller batch.

  - ### RATE_LIMITED

    public static final HealthError RATE_LIMITED
    The platform rate-limited the request.

  - ### SESSION_STATE

    public static final HealthError SESSION_STATE
    A workout session method was called in a state that does not allow it -- pausing a session that never started, ending one twice.

  - ### SENSOR_DISCONNECTED

    public static final HealthError SENSOR_DISCONNECTED
    A live BLE sensor dropped its connection mid-session.

  - ### TIMEOUT

    public static final HealthError TIMEOUT
    The operation did not complete within its safety timeout.

  - ### UNKNOWN

    public static final HealthError UNKNOWN
    Anything the port could not classify. The message carries the platform's own text.

- ## Method Details

  - ### values

    public static HealthError[] values()
    Returns an array containing the constants of this enum type, in the order they are declared.
    Returns:
      an array containing the constants of this enum type, in the order they are declared

  - ### valueOf

    public static HealthError valueOf(String name)
    Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
      `NullPointerException` - if the argument is null