Override toString() on ErrorResponse

Partially reverts last commit that added first error message to exception
without checking for presence of such.
This commit is contained in:
Stefan Kalscheuer 2017-09-25 20:48:36 +02:00
parent 4b14ab3f4b
commit f70fc084be
2 changed files with 10 additions and 1 deletions

View File

@ -849,7 +849,7 @@ public class HTTPVaultConnector implements VaultConnector {
if (!er.getErrors().isEmpty() && er.getErrors().get(0).equals("permission denied"))
throw new PermissionDeniedException();
throw new InvalidResponseException(Error.RESPONSE_CODE,
response.getStatusLine().getStatusCode(), er.getErrors().get(0));
response.getStatusLine().getStatusCode(), er.toString());
} catch (IOException ignored) {
// Exception ignored.
}

View File

@ -38,4 +38,13 @@ public final class ErrorResponse implements VaultResponse {
public List<String> getErrors() {
return errors;
}
@Override
public String toString() {
if (errors == null || errors.isEmpty()) {
return "error response";
} else {
return errors.get(0);
}
}
}