Package org.springframework.vault.client
Class VaultClientResponseException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.springframework.core.NestedRuntimeException
org.springframework.vault.VaultException
org.springframework.vault.client.VaultClientResponseException
- All Implemented Interfaces:
Serializable
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 Summary
ConstructorsConstructorDescriptionCreate aVaultClientResponseExceptionwith the specified detail message.VaultClientResponseException(String msg, @Nullable Throwable cause) Create aVaultClientResponseExceptionwith the specified detail message and nested exception. -
Method Summary
Modifier and TypeMethodDescriptionabstract <E> @Nullable EgetResponseBodyAs(Class<E> targetType) Convert the error response content to the specified type.abstract <E> @Nullable EgetResponseBodyAs(ParameterizedTypeReference<E> targetType) Variant ofgetResponseBodyAs(Class)withParameterizedTypeReference.abstract byte[]Return the response body as a byte array.Return the response body converted to String.abstract StringgetResponseBodyAsString(Charset fallbackCharset) Return the response body converted to String.@Nullable HttpHeadersReturn the HTTP response headers.abstract HttpStatusCodeReturn the HTTP status code.abstract StringReturn the HTTP status text.toString()Methods inherited from class org.springframework.core.NestedRuntimeException
contains, getMostSpecificCause, getRootCauseMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Constructor Details
-
VaultClientResponseException
Create aVaultClientResponseExceptionwith the specified detail message.- Parameters:
msg- the detail message.
-
VaultClientResponseException
Create aVaultClientResponseExceptionwith the specified detail message and nested exception.- Parameters:
msg- the detail message.cause- the nested exception.
-
-
Method Details
-
getStatusCode
Return the HTTP status code. -
getStatusText
Return the HTTP status text. -
getResponseHeaders
Return the HTTP response headers. -
getResponseBodyAsByteArray
public abstract byte[] getResponseBodyAsByteArray()Return the response body as a byte array. -
getResponseBodyAsString
Return the response body converted to String. The charset used is that of the response "Content-Type" or otherwise"UTF-8". -
getResponseBodyAsString
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
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
nullif there is no content.
-
getResponseBodyAs
Variant ofgetResponseBodyAs(Class)withParameterizedTypeReference. -
toString
-