mirror of https://github.com/apache/jclouds.git
updated error parser to work with Nova EC2 error message
This commit is contained in:
parent
00c7179f72
commit
dca3631aad
|
@ -102,7 +102,7 @@ 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 (errorCode != null && (errorCode.endsWith("NotFound") || 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)
|
||||||
|| (errorCode != null && (error.getCode().endsWith(".Duplicate") | error.getCode().endsWith(
|
|| (errorCode != null && (error.getCode().endsWith(".Duplicate") | error.getCode().endsWith(
|
||||||
|
|
|
@ -68,6 +68,12 @@ public class ParseAWSErrorFromXmlContentTest {
|
||||||
assertCodeMakes("GET", URI.create("https://amazonaws.com/foo"), 400, "",
|
assertCodeMakes("GET", URI.create("https://amazonaws.com/foo"), 400, "",
|
||||||
"<Error><Code>LoadBalancerNotFound</Code></Error>", ResourceNotFoundException.class);
|
"<Error><Code>LoadBalancerNotFound</Code></Error>", ResourceNotFoundException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test400WithSecurityGroupNotFoundForProjectSetsResourceNotFoundException() {
|
||||||
|
assertCodeMakes("GET", URI.create("https://amazonaws.com/foo"), 400, "",
|
||||||
|
"<Error><Code>SecurityGroupNotFoundForProject</Code></Error>", ResourceNotFoundException.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test400WithUnsupportedCodeMakesUnsupportedOperationException() {
|
public void test400WithUnsupportedCodeMakesUnsupportedOperationException() {
|
||||||
|
|
Loading…
Reference in New Issue