Class LauncherException

All Implemented Interfaces:
Serializable

public final class LauncherException extends RuntimeException
A ClientLauncher call that failed. code() is a stable snake_case identifier and is what to branch on; the message is English for logs and is never parsed.

Most codes come from the launcher service. SERVICE_UNAVAILABLE and SERVICE_STOPPED are raised by the host when no service answered.

See Also:
  • Field Details

    • SERVICE_UNAVAILABLE

      public static final String SERVICE_UNAVAILABLE
      No service is reachable, or it did not answer in time. Retry later.
      See Also:
    • SERVICE_STOPPED

      public static final String SERVICE_STOPPED
      The user stopped the service from the tray. The host will not start it.
      See Also:
    • NOT_PERMITTED

      public static final String NOT_PERMITTED
      The call is outside this script's targets, or not allowed on this surface.
      See Also:
    • RATE_LIMITED

      public static final String RATE_LIMITED
      The automation launch budget is spent; see retryAfterMs().
      See Also:
    • ACCOUNT_NOT_FOUND

      public static final String ACCOUNT_NOT_FOUND
      No account has that id.
      See Also:
    • CLIENT_NOT_FOUND

      public static final String CLIENT_NOT_FOUND
      No client has that id.
      See Also:
  • Constructor Details

    • LauncherException

      public LauncherException(String code, String message)
      Parameters:
      code - the wire or host code
      message - English text for logs
    • LauncherException

      public LauncherException(String code, String message, boolean isRetryable, OptionalLong retryAfterMs, Optional<String> field)
      Parameters:
      code - the wire or host code
      message - English text for logs
      isRetryable - whether the service said a retry may succeed
      retryAfterMs - for rate_limited, how long to wait
      field - for bad_request, the offending field
    • LauncherException

      public LauncherException(String code, String message, Throwable cause)
      Parameters:
      code - the host code
      message - English text for logs
      cause - what failed underneath
  • Method Details

    • code

      public String code()
      Returns:
      the stable code, for example "rate_limited"
    • isRetryable

      public boolean isRetryable()
      Returns:
      whether the service marked the failure retryable
    • retryAfterMs

      public OptionalLong retryAfterMs()
      Returns:
      for rate_limited, the wait before a launch can succeed
    • field

      public Optional<String> field()
      Returns:
      for bad_request, the field the service refused