Skip to content

Commit

Permalink
项目管理--项目上传错误提示优化
Browse files Browse the repository at this point in the history
  • Loading branch information
frankfreedom committed Aug 17, 2020
1 parent 095e8a8 commit 3fdef31
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,19 +202,20 @@ public Map<String, ValidationReport> uploadProject(final Project project,
private File unzipProject(final File archive, final String fileType)
throws ProjectManagerException {
final File file;
try {

if (fileType == null) {
throw new ProjectManagerException("Unknown file type for "
+ archive.getName());
} else if ("zip".equals(fileType)) {
file = unzipFile(archive);
try {
file = unzipFile(archive);
} catch (final Exception e) {
throw new ProjectManagerException("Error unzipping file:" + archive.getName() + ", Please check if there are Chinese characters in the file name.", e);
}
} else {
throw new ProjectManagerException("Unsupported archive type for file "
+ archive.getName());
}
} catch (final IOException e) {
throw new ProjectManagerException("Error unzipping file.", e);
}
return file;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ private void loadProjectFromDir(final String base, final File dir, Props parent)
final FlowProps flowProps = new FlowProps(parent);
this.flowPropsList.add(flowProps);
} catch (final IOException e) {
this.errors.add("Error loading properties " + file.getName() + ":"
this.logger.error("Error loading properties {}, cause by :", file.getName(), e);
this.errors.add("Error loading properties " + file.getName() + ", cause by :"
+ e.getMessage());
}

Expand All @@ -175,7 +176,7 @@ private void loadProjectFromDir(final String base, final File dir, Props parent)
try {
if (!this.duplicateJobs.contains(jobName)) {
if (this.jobPropsMap.containsKey(jobName)) {
this.errors.add("Duplicate job names found '" + jobName + "'.");
this.errors.add("Duplicate job names found '" + file.getName() + "'.");
this.duplicateJobs.add(jobName);
this.jobPropsMap.remove(jobName);
this.nodeMap.remove(jobName);
Expand All @@ -187,7 +188,7 @@ private void loadProjectFromDir(final String base, final File dir, Props parent)
final Node node = new Node(jobName);
final String type = prop.getString("type", null);
if (type == null) {
this.errors.add("Job doesn't have type set '" + jobName + "', please check whether the file encoding is UNIX, UTF-8.");
this.errors.add("Job type property not found in file '" + file.getName() + "', please check whether the file encoding is UNIX, UTF-8.");
}

node.setType(type);
Expand All @@ -212,7 +213,8 @@ private void loadProjectFromDir(final String base, final File dir, Props parent)
}
}
} catch (final IOException e) {
this.errors.add("Error loading job file " + file.getName() + ":"
this.logger.error("Error loading job file {}, cause by :", file.getName(), e);
this.errors.add("Error loading job file " + file.getName() + ", cause by : "
+ e.getMessage());
}
}
Expand Down Expand Up @@ -286,19 +288,22 @@ private void resolveDependencies() {
if (this.duplicateJobs.contains(dependencyName)) {
edge.setError("Ambiguous Dependency. Duplicates found.");
dependencies.put(dependencyName, edge);
this.errors.add(node.getId() + " 依赖关系不清晰 "
// 依赖关系不清晰
this.errors.add(node.getId() + " has ambiguous dependency, please check the dependency information."
+ dependencyName);
} else {
edge.setError("Dependency not found.");
dependencies.put(dependencyName, edge);
this.errors.add(node.getId() + " 找不到依赖 "
// 找不到依赖
this.errors.add(node.getId() + " cannot find dependency, please check the dependency information. "
+ dependencyName);
}
} else if (dependencyNode == node) {
// We have a self cycle
edge.setError("Self cycle found.");
dependencies.put(dependencyName, edge);
this.errors.add(node.getId() + " 有一个死循环");
// 有一个死循环
this.errors.add(node.getId() + " has a self cycle, please check the dependency information.");
} else {
dependencies.put(dependencyName, edge);
}
Expand Down

0 comments on commit 3fdef31

Please sign in to comment.