Skip to content

Commit

Permalink
add try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
krwong committed Aug 29, 2024
1 parent b0f8816 commit 60bd504
Showing 1 changed file with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,24 @@ public JsonNode listProjects(Path directory) throws Exception {

for (File file : directory.toFile().listFiles()) {
if (file.isDirectory()) {
MigrationProject project = initializeProject(file.toPath());

Path projectPath = directory.toAbsolutePath();
String projectStatus = status(project);
ArrayNode allowedActions = mapper.valueToTree(allowedActions(project));
JsonNode projectProperties = mapper.readTree(project.getProjectPropertiesPath().toFile());

// add project info to JSON
ObjectNode objectNode = mapper.createObjectNode();
objectNode.put(PROJECT_PATH, projectPath.toString());
objectNode.put(STATUS, projectStatus);
objectNode.putArray(ALLOWED_ACTIONS).addAll(allowedActions);
objectNode.set("projectProperties", projectProperties);
arrayNode.add(objectNode);
try {
MigrationProject project = initializeProject(file.toPath());

Path projectPath = directory.toAbsolutePath();
String projectStatus = status(project);
ArrayNode allowedActions = mapper.valueToTree(allowedActions(project));
JsonNode projectProperties = mapper.readTree(project.getProjectPropertiesPath().toFile());

// add project info to JSON
ObjectNode objectNode = mapper.createObjectNode();
objectNode.put(PROJECT_PATH, projectPath.toString());
objectNode.put(STATUS, projectStatus);
objectNode.putArray(ALLOWED_ACTIONS).addAll(allowedActions);
objectNode.set("projectProperties", projectProperties);
arrayNode.add(objectNode);
} catch (Exception e) {
log.error(e.getMessage());
}
}
}
log.debug(arrayNode.toString());
Expand Down

0 comments on commit 60bd504

Please sign in to comment.