[Geoserver-devel] How can my geoserver OWS report the reason for failing a database connection?

I’m using the DataSourceFinder.getDataSource() method which will create a data source based on a JDBC connection parameters. If the datasource is unable to establish a connection, that will get logged down inside this code but the exception/reason for the failure is not exposed to the client – i.e. I just get a null result from the method.

I would like to report the exception detail to the caller of my service. An invalid user/password has a much different resolution than hostname not found for example. Is there a straightforward means for doing this that I’m not aware of?

To me it makes a lot more sense for DataSource.getConnection() to fail with an exception than it does for getDataSource() to simply return null.