DataDog / datadogpy

The Datadog Python library
https://datadoghq.com/
Other
612 stars 304 forks source link

statsd.event should raise something more specific than Exception #725

Closed tylertrussell closed 2 years ago

tylertrussell commented 2 years ago

Is your feature request related to a problem? Please describe. The statsd.event function will raise Exception in the event the payload is invalid (i.e. too big). This prevents users of the library from catching a specific exception, and could lead to other types of errors (e.g. TypeError) being "swallowed" when they should be allowed to propagate.

Describe the solution you'd like Instead of Exception, the library should raise a ValueError (or some other more-specific Exception subclass).

Describe alternatives you've considered Users of the library could catch an Exception and then try to compare the error message, which is not great.

Updating to remove stale tag; this is still reproducible.

github-actions[bot] commented 2 years ago

Thanks for your contribution!

This issue has been automatically marked as stale because it has not had activity in the last 30 days. Note that the issue will not be automatically closed, but this notification will remind us to investigate why there's been inactivity. Thank you for participating in the Datadog open source community.

If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of this project.

  2. Comment that the issue is still reproducible and include updated details requested in the issue template.

tylertrussell commented 2 years ago

I confirm that I can still reproduce this issue in the latest version of the project.

There is an open PR #730 that addresses this issue, it would be excellent to have that reviewed by the relevant parties at some point soon.

sgnn7 commented 2 years ago

@tylertrussell The linked PR has been merged so it should be out with the next release of this library (probably 0.45.x). I'll mark this issue as closed but feel free to reopen if needed.