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:
parent
4b14ab3f4b
commit
f70fc084be
@ -849,7 +849,7 @@ public class HTTPVaultConnector implements VaultConnector {
|
|||||||
if (!er.getErrors().isEmpty() && er.getErrors().get(0).equals("permission denied"))
|
if (!er.getErrors().isEmpty() && er.getErrors().get(0).equals("permission denied"))
|
||||||
throw new PermissionDeniedException();
|
throw new PermissionDeniedException();
|
||||||
throw new InvalidResponseException(Error.RESPONSE_CODE,
|
throw new InvalidResponseException(Error.RESPONSE_CODE,
|
||||||
response.getStatusLine().getStatusCode(), er.getErrors().get(0));
|
response.getStatusLine().getStatusCode(), er.toString());
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
// Exception ignored.
|
// Exception ignored.
|
||||||
}
|
}
|
||||||
|
@ -38,4 +38,13 @@ public final class ErrorResponse implements VaultResponse {
|
|||||||
public List<String> getErrors() {
|
public List<String> getErrors() {
|
||||||
return errors;
|
return errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
if (errors == null || errors.isEmpty()) {
|
||||||
|
return "error response";
|
||||||
|
} else {
|
||||||
|
return errors.get(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user