CORDA-3558: Allow initial registration errors to propagate up so the node exits with a failure code (#5899)

This commit is contained in:
Ryan Fowler 2020-01-27 15:23:07 +00:00 committed by Rick Parker
parent 08925ee0a5
commit e8d6701f87

View File

@ -86,12 +86,10 @@ class InitialRegistration(val baseDirectory: Path, private val networkRootTrustS
private fun initialRegistration(config: NodeConfiguration) {
// Null checks for [compatibilityZoneURL], [rootTruststorePath] and
// [rootTruststorePassword] have been done in [CmdLineOptions.loadConfig]
val result = attempt { registerWithNetwork(config) }.doOnFailure(Consumer(this::handleRegistrationError))
attempt { registerWithNetwork(config) }.doOnFailure(Consumer(this::handleRegistrationError)).getOrThrow()
if (result.isSuccess) {
// At this point the node registration was successful. We can delete the marker file.
deleteNodeRegistrationMarker(baseDirectory)
}
// At this point the node registration was successful. We can delete the marker file.
deleteNodeRegistrationMarker(baseDirectory)
}
private fun deleteNodeRegistrationMarker(baseDir: Path) {