Class VaultClientResponseException

All Implemented Interfaces:
Serializable

public abstract class VaultClientResponseException extends VaultException
Abstract base class for exceptions thrown by VaultClient and ReactiveVaultClient in case a request fails because of a server error response, a failure to decode the response, or a low level I/O error.

Server error responses are determined by status handlers for RestClient, and by ResponseErrorHandler for RestTemplate.

Since:
4.1
Author:
Mark Paluch
See Also:
  • Constructor Details

    • VaultClientResponseException

      public VaultClientResponseException(String msg)
      Create a VaultClientResponseException with the specified detail message.
      Parameters:
      msg - the detail message.
    • VaultClientResponseException

      public VaultClientResponseException(String msg, @Nullable Throwable cause)
      Create a VaultClientResponseException with the specified detail message and nested exception.
      Parameters:
      msg - the detail message.
      cause - the nested exception.
  • Method Details

    • getStatusCode

      public abstract HttpStatusCode getStatusCode()
      Return the HTTP status code.
    • getStatusText

      public abstract String getStatusText()
      Return the HTTP status text.
    • getResponseHeaders

      public @Nullable HttpHeaders getResponseHeaders()
      Return the HTTP response headers.
    • getResponseBodyAsByteArray

      public abstract byte[] getResponseBodyAsByteArray()
      Return the response body as a byte array.
    • getResponseBodyAsString

      public String getResponseBodyAsString()
      Return the response body converted to String. The charset used is that of the response "Content-Type" or otherwise "UTF-8".
    • getResponseBodyAsString

      public abstract String getResponseBodyAsString(Charset fallbackCharset)
      Return the response body converted to String. The charset used is that of the response "Content-Type" or otherwise the one given.
      Parameters:
      fallbackCharset - the charset to use on if the response doesn't specify.
    • getResponseBodyAs

      public abstract <E> @Nullable E getResponseBodyAs(Class<E> targetType)
      Convert the error response content to the specified type.
      Type Parameters:
      E - the expected target type.
      Parameters:
      targetType - the type to convert to.
      Returns:
      the converted object, or null if there is no content.
    • getResponseBodyAs

      public abstract <E> @Nullable E getResponseBodyAs(ParameterizedTypeReference<E> targetType)
    • toString

      public String toString()
      Overrides:
      toString in class Throwable