[ENT-1837] Better message, but retain original exception (#3330)

* Retain original exception
This commit is contained in:
Maksymilian Pawlak 2018-06-08 18:14:59 +01:00 committed by GitHub
parent 002d5a8f10
commit 003684b7fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1029,7 +1029,7 @@ fun configureDatabase(hikariProperties: Properties,
return CordaPersistence(dataSource, databaseConfig, schemaService.schemaOptions.keys, attributeConverters)
} catch (ex: Exception) {
when {
ex is HikariPool.PoolInitializationException -> throw CouldNotCreateDataSourceException("Could not connect to the database. Please check your JDBC connection URL, or the connectivity to the database.")
ex is HikariPool.PoolInitializationException -> throw CouldNotCreateDataSourceException("Could not connect to the database. Please check your JDBC connection URL, or the connectivity to the database.", ex)
ex.cause is ClassNotFoundException -> throw CouldNotCreateDataSourceException("Could not find the database driver class. Please add it to the 'drivers' folder. See: https://docs.corda.net/corda-configuration-file.html")
else -> throw CouldNotCreateDataSourceException("Could not create the DataSource: ${ex.message}", ex)
}