@@ -336,24 +336,23 @@ private void checkMetadata(TableMetadata metadata) {
336336 }
337337 if (metadata .getColumnDataType (partitionKeyName ) == DataType .BLOB ) {
338338 throw new IllegalArgumentException (
339- "BLOB type is supported only for the last column in partition key in DynamoDB: "
340- + partitionKeyName );
339+ CoreError .DYNAMO_PARTITION_KEY_BLOB_TYPE_NOT_SUPPORTED .buildMessage (partitionKeyName ));
341340 }
342341 }
343342
344343 for (String clusteringKeyName : metadata .getClusteringKeyNames ()) {
345344 if (metadata .getColumnDataType (clusteringKeyName ) == DataType .BLOB ) {
346345 throw new IllegalArgumentException (
347- "Currently, BLOB type is not supported for clustering keys in DynamoDB: "
348- + clusteringKeyName );
346+ CoreError . DYNAMO_CLUSTERING_KEY_BLOB_TYPE_NOT_SUPPORTED . buildMessage (
347+ clusteringKeyName ) );
349348 }
350349 }
351350
352351 for (String secondaryIndexName : metadata .getSecondaryIndexNames ()) {
353352 if (metadata .getColumnDataType (secondaryIndexName ) == DataType .BOOLEAN ) {
354353 throw new IllegalArgumentException (
355- "Currently, BOOLEAN type is not supported for a secondary index in DynamoDB: "
356- + secondaryIndexName );
354+ CoreError . DYNAMO_INDEX_COLUMN_BOOLEAN_TYPE_NOT_SUPPORTED . buildMessage (
355+ secondaryIndexName ) );
357356 }
358357 }
359358 }
@@ -951,16 +950,11 @@ public void createIndex(
951950 throws ExecutionException {
952951 Namespace namespace = Namespace .of (namespacePrefix , nonPrefixedNamespace );
953952 TableMetadata metadata = getTableMetadata (nonPrefixedNamespace , table );
954-
955- if (metadata == null ) {
956- throw new IllegalArgumentException (
957- "The " + getFullTableName (namespace , table ) + " table does not exist" );
958- }
953+ assert metadata != null ;
959954
960955 if (metadata .getColumnDataType (columnName ) == DataType .BOOLEAN ) {
961956 throw new IllegalArgumentException (
962- "Currently, BOOLEAN type is not supported for a secondary index in DynamoDB: "
963- + columnName );
957+ CoreError .DYNAMO_INDEX_COLUMN_BOOLEAN_TYPE_NOT_SUPPORTED .buildMessage (columnName ));
964958 }
965959
966960 long ru = Long .parseLong (options .getOrDefault (REQUEST_UNIT , DEFAULT_REQUEST_UNIT ));
@@ -1033,7 +1027,8 @@ columnName, getFullTableName(namespace, table)),
10331027 TableMetadata .newBuilder (tableMetadata ).addSecondaryIndex (columnName ).build ());
10341028 }
10351029
1036- private boolean rawIndexExists (String nonPrefixedNamespace , String table , String indexName ) {
1030+ private boolean rawIndexExists (String nonPrefixedNamespace , String table , String indexName )
1031+ throws ExecutionException {
10371032 Namespace namespace = Namespace .of (namespacePrefix , nonPrefixedNamespace );
10381033 String globalIndexName =
10391034 String .join (
@@ -1061,7 +1056,7 @@ private boolean rawIndexExists(String nonPrefixedNamespace, String table, String
10611056 return true ;
10621057 }
10631058 if (retryCount ++ >= MAX_RETRY_COUNT ) {
1064- throw new IllegalStateException (
1059+ throw new ExecutionException (
10651060 String .format (
10661061 "Waiting for the secondary index %s on the %s table to be active failed" ,
10671062 indexName , getFullTableName (namespace , table )));
@@ -1459,15 +1454,13 @@ public void renameColumn(
14591454 @ Override
14601455 public TableMetadata getImportTableMetadata (
14611456 String namespace , String table , Map <String , DataType > overrideColumnsType ) {
1462- throw new UnsupportedOperationException (
1463- "Import-related functionality is not supported in DynamoDB" );
1457+ throw new UnsupportedOperationException (CoreError .DYNAMO_IMPORT_NOT_SUPPORTED .buildMessage ());
14641458 }
14651459
14661460 @ Override
14671461 public void addRawColumnToTable (
14681462 String namespace , String table , String columnName , DataType columnType ) {
1469- throw new UnsupportedOperationException (
1470- "Import-related functionality is not supported in DynamoDB" );
1463+ throw new UnsupportedOperationException (CoreError .DYNAMO_IMPORT_NOT_SUPPORTED .buildMessage ());
14711464 }
14721465
14731466 @ Override
@@ -1476,8 +1469,7 @@ public void importTable(
14761469 String table ,
14771470 Map <String , String > options ,
14781471 Map <String , DataType > overrideColumnsType ) {
1479- throw new UnsupportedOperationException (
1480- "Import-related functionality is not supported in DynamoDB" );
1472+ throw new UnsupportedOperationException (CoreError .DYNAMO_IMPORT_NOT_SUPPORTED .buildMessage ());
14811473 }
14821474
14831475 @ Override
0 commit comments