com.bettercloud.vault.VaultException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vault-java-driver Show documentation
Show all versions of vault-java-driver Show documentation
Zero-dependency Java client for HashiCorp's Vault
package com.bettercloud.vault;
public class VaultException extends Exception {
private int httpStatusCode;
public VaultException(final String message) {
super(message);
}
public VaultException(final Throwable t) {
super(t);
}
/**
* Use this constructor to generate a VaultException
instance that is based on receiving a
* particular HTTP status code from a Vault server (e.g. 500).
*
* @param message A string expressing the exception cause
* @param httpStatusCode An HTTP status code returned by a Vault server (e.g. 500)
*/
public VaultException(final String message, final int httpStatusCode) {
super(message);
this.httpStatusCode = httpStatusCode;
}
/**
* Use this constructor to generate a VaultException
instance that is based on receiving a
* particular HTTP status code from a Vault server (e.g. 500).
*
* @param t Another exception that this VaultException
will wrap
* @param httpStatusCode An HTTP status code returned by a Vault server (e.g. 500)
*/
public VaultException(final Throwable t, final int httpStatusCode) {
super(t);
this.httpStatusCode = httpStatusCode;
}
/**
* An HTTP status code, returned from a Vault server, that is the cause of this VaultException
.
*
* Some exceptions are not caused on the Vault side. Obviously, if there is no relevant HTTP status code then
* this method will return 0
.
*
* @return An HTTP status code, returned from a Vault server, that is the cause of this VaultException
*/
public int getHttpStatusCode() {
return httpStatusCode;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy