Consistently attach cause to exceptions.

Closes gh-713
This commit is contained in:
Mark Paluch
2023-03-17 10:26:00 +01:00
parent 73af38127e
commit aeaf571d2d
3 changed files with 3 additions and 3 deletions

View File

@@ -90,7 +90,7 @@ public class LoginTokenAdapter implements ClientAuthentication {
}
catch (HttpStatusCodeException e) {
throw new VaultTokenLookupException(String.format("Token self-lookup failed: %s %s", e.getRawStatusCode(),
VaultResponses.getError(e.getResponseBodyAsString())));
VaultResponses.getError(e.getResponseBodyAsString())), e);
}
catch (RestClientException e) {
throw new VaultTokenLookupException("Token self-lookup failed", e);

View File

@@ -61,7 +61,7 @@ public class VaultLoginException extends VaultException {
String.format("Cannot login using %s: %s", authMethod, VaultResponses.getError(response)), cause);
}
return new VaultLoginException(String.format("Cannot login using %s", cause));
return new VaultLoginException(String.format("Cannot login using %s", cause), cause);
}
}

View File

@@ -82,7 +82,7 @@ public abstract class AbstractResult<V> {
return get0();
}
throw new VaultException(this.exception.getMessage());
throw new VaultException(this.exception.getMessage(), this.exception);
}
/**