Class AltsException

All Implemented Interfaces:
Serializable

public final class AltsException extends RuntimeException
The one exception the library throws for a failure, and the only one a library future completes with exceptionally (inside the JDK's CompletionException).

Branch on failure().kind(). The message is AltsFailure.message(): built by the library, never a transport exception's text, a token or a path. The underlying failure, where there was one, is kept as the cause for a host that wants to log it deliberately; its own message may quote a credential, so it is never shown.

Java serialization does not carry the AltsFailure: an instance is not serializable.

Since:
1.0.0
See Also:
  • Constructor Details

    • AltsException

      public AltsException(AltsFailure failure)
      Creates an exception carrying failure.
      Parameters:
      failure - what went wrong
      Throws:
      NullPointerException - if failure is null
      Since:
      1.0.0
    • AltsException

      public AltsException(AltsFailure failure, Throwable cause)
      Creates an exception carrying failure and the underlying failure it was classified from.
      Parameters:
      failure - what went wrong
      cause - the underlying failure, or null
      Throws:
      NullPointerException - if failure is null
      Since:
      1.0.0
    • AltsException

      public AltsException(AltsFailure.Kind kind, String message)
      Creates an exception carrying a fresh failure of kind.
      Parameters:
      kind - what kind of failure it is
      message - a short description built by the library
      Since:
      1.0.0
  • Method Details

    • failure

      public AltsFailure failure()
      Returns what went wrong.
      Returns:
      the failure, never null
      Since:
      1.0.0
    • kind

      public AltsFailure.Kind kind()
      Returns the kind of failure, shorthand for failure().kind().
      Returns:
      the kind
      Since:
      1.0.0