Catching all sagan exceptions

This commit is contained in:
Marcin Grzejszczak
2020-09-25 12:13:46 +02:00
parent fd15be7838
commit 703b6197ff
2 changed files with 21 additions and 17 deletions

View File

@@ -64,22 +64,27 @@ public class SaganUpdater {
originalVersion, currentVersion, projects);
if (updateReleaseException == null) {
log.info("Updating Sagan releases with \n\n{}", update);
Project project = this.saganClient.updateRelease(currentVersion.projectName,
Collections.singletonList(update));
Optional<ProjectVersion> projectVersion = latestVersion(currentVersion,
project);
log.info("Found the following latest project version [{}]", projectVersion);
boolean present = projectVersion.isPresent();
if (present && currentVersionNewerOrEqual(currentVersion, projectVersion)) {
updateDocumentationIfNecessary(projectFile, project);
}
else {
log.info(present
? "Latest version [" + projectVersion.get() + "] present and "
+ "the current version [" + currentVersion
+ "] is older than that one. " + "Will do nothing."
: "No latest version found. Will do nothing.");
return ExecutionResult.skipped();
try {
Project project = this.saganClient.updateRelease(currentVersion.projectName,
Collections.singletonList(update));
Optional<ProjectVersion> projectVersion = latestVersion(currentVersion,
project);
log.info("Found the following latest project version [{}]", projectVersion);
boolean present = projectVersion.isPresent();
if (present && currentVersionNewerOrEqual(currentVersion, projectVersion)) {
updateDocumentationIfNecessary(projectFile, project);
}
else {
log.info(present
? "Latest version [" + projectVersion.get() + "] present and "
+ "the current version [" + currentVersion
+ "] is older than that one. " + "Will do nothing."
: "No latest version found. Will do nothing.");
return ExecutionResult.skipped();
}
} catch (Exception ex) {
log.warn("Exception occurred while trying to update sagan release", ex);
updateReleaseException = ex;
}
}
return updateReleaseException == null ? ExecutionResult.success()

View File

@@ -75,7 +75,6 @@ public class ExecutionResult implements Serializable {
return new RuntimeException(
"[Breaking self reference chain] " + cause.toString());
}
System.out.println("Not breaking the reference chain. . . i think");
return cause;
}