influxdata / influxdb-client-php

InfluxDB (v2+) Client Library for PHP
https://influxdata.github.io/influxdb-client-php/
MIT License
150 stars 47 forks source link

Omission of a required Field should trigger an exception rather than failing silently #149

Open baptgb opened 1 year ago

baptgb commented 1 year ago

Proposal: Introduce a distinct exception for attempts to write a Point without a field. This would facilitate debugging, accelerate the learning curve for InfluxDB's key concepts, and provide a transparent error message.

Current behavior: Writing a Point without a field currently results in silent failure, with the Point being transformed to null and no indication that the Point has been disregarded.

Desired behavior: Trigger an exception when a developer attempts to write a Point with no field.

Alternatives considered: Display a clear warning to indicate that the Point is being ignored due to the absence of a field.

Use case: InfluxDB mandates that each Point must contain at least one field. This requirement might not be intuitive for newcomers. Thus, generating an exception for such cases would significantly reduce time and frustration when initially working with the database. In my experience, I had to debug the client's code to understand why my Point wasn't being written. Although it's essential to have at least one field, this wasn't immediately clear to me, leading to unnecessary confusion.