File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
service/common/src/main/java/org/apache/polaris/service/catalog/policy Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change 3131import org .apache .polaris .core .entity .PolarisEntityType ;
3232import org .apache .polaris .core .persistence .PolarisMetaStoreManager ;
3333import org .apache .polaris .core .persistence .PolarisResolvedPathWrapper ;
34- import org .apache .polaris .core .persistence .dao .entity .BaseResult ;
3534import org .apache .polaris .core .persistence .dao .entity .DropEntityResult ;
3635import org .apache .polaris .core .persistence .dao .entity .EntityResult ;
3736import org .apache .polaris .core .persistence .resolver .PolarisResolutionManifestCatalogView ;
@@ -115,13 +114,15 @@ public Policy createPolicy(
115114
116115 if (!res .isSuccess ()) {
117116
118- if (res .getReturnStatus () == BaseResult .ReturnStatus .ENTITY_ALREADY_EXISTS ) {
119- throw new AlreadyExistsException ("Policy already exists %s" , policyIdentifier );
120- } else {
121- throw new IllegalStateException (
122- String .format (
123- "Unknown error status for identifier %s: %s with extraInfo: %s" ,
124- policyIdentifier , res .getReturnStatus (), res .getExtraInformation ()));
117+ switch (res .getReturnStatus ()) {
118+ case ENTITY_ALREADY_EXISTS :
119+ throw new AlreadyExistsException ("Policy already exists %s" , policyIdentifier );
120+
121+ default :
122+ throw new IllegalStateException (
123+ String .format (
124+ "Unknown error status for identifier %s: %s with extraInfo: %s" ,
125+ policyIdentifier , res .getReturnStatus (), res .getExtraInformation ()));
125126 }
126127 }
127128
You can’t perform that action at this time.
0 commit comments