diff options
author | MS <ms@taler.net> | 2021-01-28 23:30:13 +0100 |
---|---|---|
committer | MS <ms@taler.net> | 2021-01-28 23:30:13 +0100 |
commit | f1417a7334806708d901d805b768bdbce6e74958 (patch) | |
tree | 7ae6975605762e8cf827a93662f75a00a8cb2625 /nexus | |
parent | 12577b58c1ffd43ba43ca5b0a41c4b7c6131b47d (diff) | |
download | libeufin-f1417a7334806708d901d805b768bdbce6e74958.tar.gz libeufin-f1417a7334806708d901d805b768bdbce6e74958.tar.bz2 libeufin-f1417a7334806708d901d805b768bdbce6e74958.zip |
end gracefully when port isn't free
Diffstat (limited to 'nexus')
-rw-r--r-- | nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt index fc08971f..fa2c2749 100644 --- a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt +++ b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt @@ -50,7 +50,9 @@ import tech.libeufin.nexus.bankaccount.* import tech.libeufin.nexus.ebics.* import tech.libeufin.nexus.iso20022.CamtBankAccountEntry import tech.libeufin.util.* +import java.net.BindException import java.net.URLEncoder +import kotlin.system.exitProcess /** * Return facade state depending on the type. @@ -1040,5 +1042,10 @@ fun serverMain(dbName: String, host: String, port: Int) { } } logger.info("LibEuFin Nexus running on port $port") - server.start(wait = true) + try { + server.start(wait = true) + } catch (e: BindException) { + logger.error(e.message) + exitProcess(1) + } } |