influxdb-java icon indicating copy to clipboard operation
influxdb-java copied to clipboard

Error msg so obscure when connect url port miss

Open camilesing opened this issue 4 years ago • 2 comments

Hi, the problem takes me some time: when I init InfluxDB instance from InfluxDBFactory.connect, I miss a port, like:

InfluxDBFactory.connect("127.0.0.1", "username", "password");

actually, the code should be

InfluxDBFactory.connect("127.0.0.1:8086", "username", "password");

but I didn't notice it. then I query a table, the program throw exception and show stack trace:

Exception in thread "main" org.influxdb.InfluxDBException: 
	at org.influxdb.InfluxDBException.buildExceptionForErrorState(InfluxDBException.java:175)
	at org.influxdb.impl.InfluxDBImpl.execute(InfluxDBImpl.java:837)
	at org.influxdb.impl.InfluxDBImpl.executeQuery(InfluxDBImpl.java:824)
	at org.influxdb.impl.InfluxDBImpl.query(InfluxDBImpl.java:559)

I think its so obscure, the exception can throw early. For example, when init InfluxDB instance, it can throw IllegalArugemntException: The port cannot be null

camilesing avatar Sep 09 '21 03:09 camilesing

good point, are you willing to write a fix in a pull request ?

majst01 avatar Sep 09 '21 05:09 majst01

@majst01 yes, I pleasure contribute to the open-source community

camilesing avatar Sep 12 '21 05:09 camilesing