Skip to content

Commit e024cb9

Browse files
fix(flow-task): optimize error message of flow task cancelation (#2624)
1 parent 20a68f1 commit e024cb9

5 files changed

Lines changed: 7 additions & 1 deletion

File tree

server/odc-core/src/main/java/com/oceanbase/odc/core/shared/constant/ErrorCodes.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ public enum ErrorCodes implements ErrorCode {
163163
FlowTaskInstanceFailed,
164164
FlowTaskInstanceCancelled,
165165
FlowCreateDeniedBySqlCheck,
166+
FlowTaskNotSupportCancel,
166167

167168
// Schedule
168169
AlterScheduleExists,

server/odc-core/src/main/resources/i18n/ErrorMessages.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ com.oceanbase.odc.ErrorCodes.FlowTaskInstanceExpired=The execution of the task t
105105
com.oceanbase.odc.ErrorCodes.FlowTaskInstanceFailed=The execution of the task failed. Details: {0}.
106106
com.oceanbase.odc.ErrorCodes.FlowTaskInstanceCancelled=The execution of the task is cancelled.
107107
com.oceanbase.odc.ErrorCodes.FlowCreateDeniedBySqlCheck=The creation of the task is rejected. Cause: The content changed contains items of the "Revision Required" category. Details: {0}.
108+
com.oceanbase.odc.ErrorCodes.FlowTaskNotSupportCancel=The current task being executed is {0} and cancellation is not supported. Please try again later.
108109
com.oceanbase.odc.ErrorCodes.ExternalServiceError=External service error. Details: {0}.
109110
com.oceanbase.odc.ErrorCodes.ExternalAasServiceError=AAS service error
110111
com.oceanbase.odc.ErrorCodes.ExternalOAMServiceError=OAM service error

server/odc-core/src/main/resources/i18n/ErrorMessages_zh_CN.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ com.oceanbase.odc.ErrorCodes.FlowTaskInstanceExpired=流程实例任务执行超
104104
com.oceanbase.odc.ErrorCodes.FlowTaskInstanceFailed=流程实例任务执行失败,错误详情:{0}
105105
com.oceanbase.odc.ErrorCodes.FlowTaskInstanceCancelled=流程实例任务执行取消
106106
com.oceanbase.odc.ErrorCodes.FlowCreateDeniedBySqlCheck=流程创建被拒绝,原因:变更内容命中“必须改进”等级的项目,详情:{0}
107+
com.oceanbase.odc.ErrorCodes.FlowTaskNotSupportCancel=当前正在执行的任务为 {0},不支持取消,请稍后重试
107108
com.oceanbase.odc.ErrorCodes.ExternalServiceError=外部服务异常,错误详情:{0}
108109
com.oceanbase.odc.ErrorCodes.ExternalAasServiceError=AAS 服务调用出错
109110
com.oceanbase.odc.ErrorCodes.ExternalOAMServiceError=OAM 服务调用出错

server/odc-core/src/main/resources/i18n/ErrorMessages_zh_TW.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ com.oceanbase.odc.ErrorCodes.FlowTaskInstanceExpired=流程實例任務執行超
103103
com.oceanbase.odc.ErrorCodes.FlowTaskInstanceFailed=流程實例任務執行失敗,錯誤詳情:{0}
104104
com.oceanbase.odc.ErrorCodes.FlowTaskInstanceCancelled=流程實例任務執行取消
105105
com.oceanbase.odc.ErrorCodes.FlowCreateDeniedBySqlCheck=流程創建被拒絕,原因:變更內容命中“必須改進”等級的項目,詳情:{0}
106+
com.oceanbase.odc.ErrorCodes.FlowTaskNotSupportCancel=當前正在執行的任務為 {0},不支持取消,請稍後重試
106107
com.oceanbase.odc.ErrorCodes.ExternalServiceError=外部服務異常,錯誤詳情:{0}
107108
com.oceanbase.odc.ErrorCodes.ExternalAasServiceError=AAS 服務調用出錯
108109
com.oceanbase.odc.ErrorCodes.ExternalOAMServiceError=OAM 服務調用出錯

server/odc-service/src/main/java/com/oceanbase/odc/service/flow/FlowInstanceService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,9 @@ private FlowInstanceDetailResp cancel(@NotNull FlowInstance flowInstance, Boolea
623623
}
624624
Long taskId = taskInstance.getTargetTaskId();
625625
if (taskId == null) {
626-
throw new IllegalStateException("RollBack task can not be cancelled");
626+
throw new UnsupportedException(ErrorCodes.FlowTaskNotSupportCancel,
627+
new Object[] {taskTypeHolder.getValue().getLocalizedMessage()},
628+
"The currently executing task does not support cancellation.");
627629
}
628630
TaskEntity taskEntity = taskService.detail(taskId);
629631
if (!dispatchChecker.isTaskEntityOnThisMachine(taskEntity)) {

0 commit comments

Comments
 (0)