mirror of https://github.com/apache/jclouds.git
JCLOUDS-44: Map TooManyBuckets to proper exception
This commit is contained in:
parent
e5a43385b3
commit
af7c003582
|
@ -103,6 +103,8 @@ public class ParseAWSErrorFromXmlContent implements HttpErrorHandler {
|
||||||
exception = new UnsupportedOperationException(message, exception);
|
exception = new UnsupportedOperationException(message, exception);
|
||||||
else if ("AddressLimitExceeded".equals(errorCode))
|
else if ("AddressLimitExceeded".equals(errorCode))
|
||||||
exception = new InsufficientResourcesException(message, exception);
|
exception = new InsufficientResourcesException(message, exception);
|
||||||
|
else if ("TooManyBuckets".equals(errorCode))
|
||||||
|
exception = new InsufficientResourcesException(message, exception);
|
||||||
else if (errorCode != null && (errorCode.indexOf("NotFound") != -1 || errorCode.endsWith(".Unknown")))
|
else if (errorCode != null && (errorCode.indexOf("NotFound") != -1 || errorCode.endsWith(".Unknown")))
|
||||||
exception = new ResourceNotFoundException(message, exception);
|
exception = new ResourceNotFoundException(message, exception);
|
||||||
else if ("IncorrectState".equals(errorCode)
|
else if ("IncorrectState".equals(errorCode)
|
||||||
|
|
|
@ -99,6 +99,17 @@ public class ParseAWSErrorFromXmlContentTest {
|
||||||
InsufficientResourcesException.class);
|
InsufficientResourcesException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test400WithTooManyBucketsCodeMakesInsufficientResourcesException() {
|
||||||
|
assertCodeMakes(
|
||||||
|
POST,
|
||||||
|
URI.create("https://ec2.us-east-1.amazonaws.com/"),
|
||||||
|
BAD_REQUEST.getStatusCode(),
|
||||||
|
"",
|
||||||
|
"<Response><Errors><Error><Code>TooManyBuckets</Code><Message>You have attempted to create more buckets than allowed</Message></Error></Errors><RequestID>c14f531a-cc35-4b48-8149-2655c7e6dc76</RequestID></Response>",
|
||||||
|
InsufficientResourcesException.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test400WithInUseCodeSetsIllegalStateException() {
|
public void test400WithInUseCodeSetsIllegalStateException() {
|
||||||
assertCodeMakes(GET, URI.create("https://amazonaws.com/foo"), BAD_REQUEST.getStatusCode(), "",
|
assertCodeMakes(GET, URI.create("https://amazonaws.com/foo"), BAD_REQUEST.getStatusCode(), "",
|
||||||
|
|
Loading…
Reference in New Issue