Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw exception if no field is provided when calling toLineProtocol() #150

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

baptgb
Copy link

@baptgb baptgb commented Sep 2, 2023

Closes #149

Proposed Changes

toLineProtocol() will throw an exception if no field is provided. This prevents the data from being silently converted to null and discarded, thereby providing the developer with a clear error message, as fields are mandatory.

Checklist

  • CHANGELOG.md updated
  • Rebased/mergeable
  • A test has been added if appropriate
  • make test completes successfully
  • Commit messages are conventional
  • Sign CLA (if not already signed)

@codecov-commenter
Copy link

codecov-commenter commented Sep 2, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (22f5d55) 74.86% compared to head (abf6b1a) 74.86%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #150   +/-   ##
=========================================
  Coverage     74.86%   74.86%           
  Complexity      424      424           
=========================================
  Files            25       25           
  Lines          1094     1094           
=========================================
  Hits            819      819           
  Misses          275      275           
Files Changed Coverage Δ
src/InfluxDB2/Point.php 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@powersj powersj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

Thanks for the issue and taking the time to put up a PR. We would like to maintain the default behavior of not throwing an exception. The change could cause issues for users who upgrade and suddenly start getting exceptions.

Is there a way you could create an option in the client to turn on this new behavior?

@baptgb
Copy link
Author

baptgb commented Sep 5, 2023

Hi,

Thanks for the issue and taking the time to put up a PR. We would like to maintain the default behavior of not throwing an exception. The change could cause issues for users who upgrade and suddenly start getting exceptions.

Is there a way you could create an option in the client to turn on this new behavior?

Hi,
Thank you for your review. I understand that introducing this change could lead to breaking issues for existing implementations. However, in my opinion, keeping this option deactivated by default somewhat diminishes its utility. I would suggest enabling it by default in the next release where breaking changes are announced.

I propose adding the silentFailOnEmptyField option to the Client, defaulting it to true. I'll go ahead and make the change if you agree.

@powersj
Copy link
Contributor

powersj commented Sep 5, 2023

I would suggest enabling it by default in the next release where breaking changes are announced.

Unfortunately, at this late in the life-cycle we do not want introduce this type of change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Omission of a required Field should trigger an exception rather than failing silently
3 participants