@@ -285,24 +285,23 @@ private void checkMetadata(TableMetadata metadata) {
285285 }
286286 if (metadata .getColumnDataType (partitionKeyName ) == DataType .BLOB ) {
287287 throw new IllegalArgumentException (
288- "BLOB type is supported only for the last column in partition key in DynamoDB: "
289- + partitionKeyName );
288+ CoreError .DYNAMO_PARTITION_KEY_BLOB_TYPE_NOT_SUPPORTED .buildMessage (partitionKeyName ));
290289 }
291290 }
292291
293292 for (String clusteringKeyName : metadata .getClusteringKeyNames ()) {
294293 if (metadata .getColumnDataType (clusteringKeyName ) == DataType .BLOB ) {
295294 throw new IllegalArgumentException (
296- "Currently, BLOB type is not supported for clustering keys in DynamoDB: "
297- + clusteringKeyName );
295+ CoreError . DYNAMO_CLUSTERING_KEY_BLOB_TYPE_NOT_SUPPORTED . buildMessage (
296+ clusteringKeyName ) );
298297 }
299298 }
300299
301300 for (String secondaryIndexName : metadata .getSecondaryIndexNames ()) {
302301 if (metadata .getColumnDataType (secondaryIndexName ) == DataType .BOOLEAN ) {
303302 throw new IllegalArgumentException (
304- "Currently, BOOLEAN type is not supported for a secondary index in DynamoDB: "
305- + secondaryIndexName );
303+ CoreError . DYNAMO_INDEX_COLUMN_BOOLEAN_TYPE_NOT_SUPPORTED . buildMessage (
304+ secondaryIndexName ) );
306305 }
307306 }
308307 }
@@ -814,16 +813,11 @@ public void createIndex(
814813 throws ExecutionException {
815814 Namespace namespace = Namespace .of (namespacePrefix , nonPrefixedNamespace );
816815 TableMetadata metadata = getTableMetadata (nonPrefixedNamespace , table );
817-
818- if (metadata == null ) {
819- throw new IllegalArgumentException (
820- "Table " + getFullTableName (namespace , table ) + " does not exist" );
821- }
816+ assert metadata != null ;
822817
823818 if (metadata .getColumnDataType (columnName ) == DataType .BOOLEAN ) {
824819 throw new IllegalArgumentException (
825- "Currently, BOOLEAN type is not supported for a secondary index in DynamoDB: "
826- + columnName );
820+ CoreError .DYNAMO_INDEX_COLUMN_BOOLEAN_TYPE_NOT_SUPPORTED .buildMessage (columnName ));
827821 }
828822
829823 long ru = Long .parseLong (options .getOrDefault (REQUEST_UNIT , DEFAULT_REQUEST_UNIT ));
@@ -1259,15 +1253,13 @@ public void renameColumn(
12591253 @ Override
12601254 public TableMetadata getImportTableMetadata (
12611255 String namespace , String table , Map <String , DataType > overrideColumnsType ) {
1262- throw new UnsupportedOperationException (
1263- "Import-related functionality is not supported in DynamoDB" );
1256+ throw new UnsupportedOperationException (CoreError .DYNAMO_IMPORT_NOT_SUPPORTED .buildMessage ());
12641257 }
12651258
12661259 @ Override
12671260 public void addRawColumnToTable (
12681261 String namespace , String table , String columnName , DataType columnType ) {
1269- throw new UnsupportedOperationException (
1270- "Import-related functionality is not supported in DynamoDB" );
1262+ throw new UnsupportedOperationException (CoreError .DYNAMO_IMPORT_NOT_SUPPORTED .buildMessage ());
12711263 }
12721264
12731265 @ Override
@@ -1276,8 +1268,7 @@ public void importTable(
12761268 String table ,
12771269 Map <String , String > options ,
12781270 Map <String , DataType > overrideColumnsType ) {
1279- throw new UnsupportedOperationException (
1280- "Import-related functionality is not supported in DynamoDB" );
1271+ throw new UnsupportedOperationException (CoreError .DYNAMO_IMPORT_NOT_SUPPORTED .buildMessage ());
12811272 }
12821273
12831274 @ Override
0 commit comments