diff --git a/deploy-service/common/src/main/java/com/pinterest/deployservice/exception/TeletaanInternalException.java b/deploy-service/common/src/main/java/com/pinterest/deployservice/exception/TeletaanInternalException.java index c76ad64dc4..ff6a4c5883 100644 --- a/deploy-service/common/src/main/java/com/pinterest/deployservice/exception/TeletaanInternalException.java +++ b/deploy-service/common/src/main/java/com/pinterest/deployservice/exception/TeletaanInternalException.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/deploy-service/common/src/main/java/com/pinterest/deployservice/handler/DeployHandler.java b/deploy-service/common/src/main/java/com/pinterest/deployservice/handler/DeployHandler.java index 11be3e9ad7..e7029b7415 100644 --- a/deploy-service/common/src/main/java/com/pinterest/deployservice/handler/DeployHandler.java +++ b/deploy-service/common/src/main/java/com/pinterest/deployservice/handler/DeployHandler.java @@ -433,8 +433,11 @@ public String deploy(EnvironBean envBean, String buildId, String desc, String de // When the delivery_type is different with stage_type and stage_type is DEFAULT, we update the stage_type; if (StringUtils.isNotBlank(deliveryType) && !envBean.getStage_type().toString().equals(deliveryType)) { if (envBean.getStage_type() != EnvType.DEFAULT) { - LOG.error("The delivery type {} is different with the stage type {} for {}/{}", + String errorMessage = String.format( + "The delivery type %s is different with the stage type %s for %s/%s", deliveryType, envBean.getStage_type(), envBean.getEnv_name(), envBean.getStage_name()); + LOG.error(errorMessage); + throw new TeletaanInternalException(Response.Status.CONFLICT, errorMessage); } else { EnvType type = EnvType.valueOf(deliveryType); envBean.setStage_type(type);