Skip to content

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

Open
baptgb wants to merge 2 commits into
influxdata:masterfrom
baptgb:feature/149-throw-exception-on-empty-field
Open

Throw exception if no field is provided when calling toLineProtocol()#150
baptgb wants to merge 2 commits into
influxdata:masterfrom
baptgb:feature/149-throw-exception-on-empty-field

Conversation

@baptgb

@baptgb baptgb commented Sep 2, 2023

Copy link
Copy Markdown

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

codecov-commenter commented Sep 2, 2023

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.86%. Comparing base (22f5d55) to head (abf6b1a).
⚠️ Report is 19 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

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           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@powersj powersj left a comment

Copy link
Copy Markdown
Contributor

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

baptgb commented Sep 5, 2023

Copy link
Copy Markdown
Author

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

powersj commented Sep 5, 2023

Copy link
Copy Markdown
Contributor

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