Directly Throw exception when taskInstancy log path is empty which log need to be queried (#15511)
This commit is contained in:
parent
e00121b44b
commit
308e4fb4a6
|
|
@ -131,7 +131,7 @@ public enum Status {
|
|||
VERIFY_USERNAME_ERROR(10100, "verify username error", "用户名验证错误"),
|
||||
UNAUTHORIZED_USER_ERROR(10101, "unauthorized user error", "查询未授权用户错误"),
|
||||
AUTHORIZED_USER_ERROR(10102, "authorized user error", "查询授权用户错误"),
|
||||
QUERY_TASK_INSTANCE_LOG_ERROR(10103, "view task instance log error", "查询任务实例日志错误"),
|
||||
QUERY_TASK_INSTANCE_LOG_ERROR(10103, "view task instance log error: {0}", "查询任务实例日志错误: {0}"),
|
||||
DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR(10104, "download task instance log file error", "下载任务日志文件错误"),
|
||||
CREATE_PROCESS_DEFINITION_ERROR(10105, "create process definition error", "创建工作流错误"),
|
||||
VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR(10106, "verify process definition name unique error", "工作流定义名称验证错误"),
|
||||
|
|
|
|||
|
|
@ -188,6 +188,11 @@ public class LoggerServiceImpl extends BaseServiceImpl implements LoggerService
|
|||
final String logPath = taskInstance.getLogPath();
|
||||
log.info("Query task instance log, taskInstanceId:{}, taskInstanceName:{}, host: {}, logPath:{}",
|
||||
taskInstance.getId(), taskInstance.getName(), taskInstance.getHost(), logPath);
|
||||
if (StringUtils.isBlank(logPath)) {
|
||||
throw new ServiceException(Status.QUERY_TASK_INSTANCE_LOG_ERROR,
|
||||
"TaskInstanceLogPath is empty, maybe the taskInstance doesn't be dispatched");
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (skipLineNum == 0) {
|
||||
String head = String.format(LOG_HEAD_FORMAT,
|
||||
|
|
@ -213,7 +218,7 @@ public class LoggerServiceImpl extends BaseServiceImpl implements LoggerService
|
|||
}
|
||||
return sb.toString();
|
||||
} catch (Throwable ex) {
|
||||
throw new ServiceException(Status.QUERY_TASK_INSTANCE_LOG_ERROR, ex);
|
||||
throw new ServiceException(Status.QUERY_TASK_INSTANCE_LOG_ERROR, ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue