Updated exception wording for region validation in StreamArn to be more consistent with other error messages

This commit is contained in:
Ryan Pelaez 2023-06-14 18:18:59 -07:00
parent a3d10bf702
commit f212e66542
2 changed files with 2 additions and 2 deletions

View file

@ -88,7 +88,7 @@ public class KinesisClientLibConfigurator {
//Parse out the region from the Arn and set (and/or override existing value for region) //Parse out the region from the Arn and set (and/or override existing value for region)
Region regionObj = Region.of(streamArnObj.region().get()); Region regionObj = Region.of(streamArnObj.region().get());
if(Region.regions().stream().filter(x -> x.id().equalsIgnoreCase(regionObj.id())).count() == 0){ if(Region.regions().stream().filter(x -> x.id().equalsIgnoreCase(regionObj.id())).count() == 0){
throw new IllegalArgumentException(String.format("%s is not a valid region", regionObj.id())); throw new IllegalArgumentException(String.format("StreamArn has unsupported region of '%s'.", regionObj.id()));
} }
configuration.setRegionName(regionObj); configuration.setRegionName(regionObj);
} else { } else {

View file

@ -98,7 +98,7 @@ public class MultiLangDaemonConfigTest {
@Test @Test
public void testConstructorFailsBecauseStreamArnHasInvalidRegion() throws Exception { public void testConstructorFailsBecauseStreamArnHasInvalidRegion() throws Exception {
setup("", "arn:aws:kinesis:us-east-1000:ACCOUNT_ID:stream/streamName"); setup("", "arn:aws:kinesis:us-east-1000:ACCOUNT_ID:stream/streamName");
assertConstructorThrowsException(IllegalArgumentException.class, "us-east-1000 is not a valid region"); assertConstructorThrowsException(IllegalArgumentException.class, "StreamArn has unsupported region of 'us-east-1000'.");
} }
@Test @Test