Enum Class AltsFailure.Kind

java.lang.Object
java.lang.Enum<AltsFailure.Kind>
lol.trq.alts.AltsFailure.Kind
All Implemented Interfaces:
Serializable, Comparable<AltsFailure.Kind>, Constable
Enclosing class:
AltsFailure

public static enum AltsFailure.Kind extends Enum<AltsFailure.Kind>
What kind of failure happened. One enum for the whole library, so a host writes its switch once; it ends in UNKNOWN so a default branch covers a constant a later release adds.

Three of them must never be confused, because their remedies are opposite: a refusal (UNAUTHORIZED, REAUTH_REQUIRED) says the credential is the problem; an unreachable service (NETWORK) says retry; a throttle (RATE_LIMITED) says wait. Sending the user through a browser sign-in to fix an outage, or retrying into a rate limit, is what conflating them costs.

Since:
1.0.0
  • Nested Class Summary

    Nested classes/interfaces inherited from class Enum

    Enum.EnumDesc<E>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    The operation was stopped on the caller's side rather than failing: the host cancelled it, the runtime was closed, or the executor it was to run on refused it.
    The request conflicts with the current state: a service answered 409, or a store file is held by another runtime, in this process or another.
    A cryptographic operation failed: a key did not unwrap, a ciphertext did not authenticate.
    The user refused an interactive sign-in: declined the consent page or the device code.
    What the caller supplied could not be used, and nothing was sent: an unreadable credential text, a skin that is not a skin, an argument out of range.
    The service could not be reached, the connection failed or timed out, or it answered with a server error (5xx, 408).
    The host's configuration is missing or was refused: Microsoft sign-in without a MicrosoftAuthConfig, or a login service that does not support device-code sign-in, or a token endpoint answering invalid_client or unauthorized_client to the host's client registration, or Minecraft services refusing that registration's Xbox login with a 403.
    The credential authenticated, but the account has no Minecraft profile or does not own the game.
    The thing asked for does not exist (404): no such resource.
    A service answered with something that is not what its protocol promises: a body that is not JSON, a field missing or of the wrong type.
    The service answered that the caller is sending too many requests (429).
    The credential is permanently spent (the token endpoint stated invalid_grant) and a fresh interactive sign-in is the only remedy.
    A store file could not be read or written.
    An interactive sign-in was not finished in time: the device code expired, or the browser sign-in was never completed.
    The credential was refused, or is empty or malformed: a token the service answered 401 or 403 to, a cookie that produced no sign-in.
    A failure the library could not classify.
    The sign-in succeeded but Xbox Live refused to authorize the account; AltsFailure.xstsError() says why, and each cause is fixed by the user at a specific place rather than by retrying.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • NETWORK

      public static final AltsFailure.Kind NETWORK
      The service could not be reached, the connection failed or timed out, or it answered with a server error (5xx, 408). Nothing was spent; retrying is the remedy.
      Since:
      1.0.0
    • RATE_LIMITED

      public static final AltsFailure.Kind RATE_LIMITED
      The service answered that the caller is sending too many requests (429). Nothing was spent; the remedy is to wait, for AltsFailure.retryAfter() when the service said how long, or to send from a different address.
      Since:
      1.0.0
    • UNAUTHORIZED

      public static final AltsFailure.Kind UNAUTHORIZED
      The credential was refused, or is empty or malformed: a token the service answered 401 or 403 to, a cookie that produced no sign-in. A stored refresh token, if there is one, may still renew the account.
      Since:
      1.0.0
    • REAUTH_REQUIRED

      public static final AltsFailure.Kind REAUTH_REQUIRED
      The credential is permanently spent (the token endpoint stated invalid_grant) and a fresh interactive sign-in is the only remedy. Where the library held it for a stored account, the refresh token has been discarded.
      Since:
      1.0.0
    • NOT_ENTITLED

      public static final AltsFailure.Kind NOT_ENTITLED
      The credential authenticated, but the account has no Minecraft profile or does not own the game. Neither retrying nor signing in again changes it. Sign-in, check and ProfileService.fetch all report a missing profile this way.
      Since:
      1.0.0
    • NOT_FOUND

      public static final AltsFailure.Kind NOT_FOUND
      The thing asked for does not exist (404): no such resource. A missing Minecraft profile is NOT_ENTITLED instead, and a lookup of a name nobody holds is an empty answer.
      Since:
      1.0.0
    • XBOX_DENIED

      public static final AltsFailure.Kind XBOX_DENIED
      The sign-in succeeded but Xbox Live refused to authorize the account; AltsFailure.xstsError() says why, and each cause is fixed by the user at a specific place rather than by retrying.
      Since:
      1.0.0
    • DECLINED

      public static final AltsFailure.Kind DECLINED
      The user refused an interactive sign-in: declined the consent page or the device code.
      Since:
      1.0.0
    • TIMED_OUT

      public static final AltsFailure.Kind TIMED_OUT
      An interactive sign-in was not finished in time: the device code expired, or the browser sign-in was never completed. Starting again issues a fresh challenge.
      Since:
      1.0.0
    • CANCELLED

      public static final AltsFailure.Kind CANCELLED
      The operation was stopped on the caller's side rather than failing: the host cancelled it, the runtime was closed, or the executor it was to run on refused it. Retrying on the same runtime does not help once it is closed.
      Since:
      1.0.0
    • INVALID_INPUT

      public static final AltsFailure.Kind INVALID_INPUT
      What the caller supplied could not be used, and nothing was sent: an unreadable credential text, a skin that is not a skin, an argument out of range.
      Since:
      1.0.0
    • CONFLICT

      public static final AltsFailure.Kind CONFLICT
      The request conflicts with the current state: a service answered 409, or a store file is held by another runtime, in this process or another.
      Since:
      1.0.0
    • NOT_CONFIGURED

      public static final AltsFailure.Kind NOT_CONFIGURED
      The host's configuration is missing or was refused: Microsoft sign-in without a MicrosoftAuthConfig, or a login service that does not support device-code sign-in, or a token endpoint answering invalid_client or unauthorized_client to the host's client registration, or Minecraft services refusing that registration's Xbox login with a 403. Neither a retry nor a fresh sign-in fixes it.
      Since:
      1.0.0
    • STORAGE

      public static final AltsFailure.Kind STORAGE
      A store file could not be read or written.
      Since:
      1.0.0
    • CRYPTO

      public static final AltsFailure.Kind CRYPTO
      A cryptographic operation failed: a key did not unwrap, a ciphertext did not authenticate.
      Since:
      1.0.0
    • PROTOCOL

      public static final AltsFailure.Kind PROTOCOL
      A service answered with something that is not what its protocol promises: a body that is not JSON, a field missing or of the wrong type.
      Since:
      1.0.0
    • UNKNOWN

      public static final AltsFailure.Kind UNKNOWN
      A failure the library could not classify.
      Since:
      1.0.0
  • Method Details

    • values

      public static AltsFailure.Kind[] 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 AltsFailure.Kind 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