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

Improve error message for errant func registration #1677

Merged

Conversation

khk-globus
Copy link
Contributor

The observed behavior in the wild was that a double registration would complain (correctly), but reference None as the function id. Clearly not helpful. Improve the situation by referencing the cached value, but also relax the double-registration constraint slightly: if the calling code attempts to re-register the function with the same id, then that's odd -- so warn about it -- but let it go. Still raise the exception for other errant registration attempts.

[sc-36241]

Type of change

  • Bug fix (non-breaking change that fixes an issue)

The observed behavior in the wild was that a double registration would complain
(correctly), but reference `None` as the function id.  Clearly not helpful.
Improve the situation by referencing the cached value, but also relax the
double-registration constraint slightly: if the calling code attempts to
re-register the function with the _same_ id, then that's odd -- so warn about
it -- but let it go.  Still raise the exception for other errant registration
attempts.

[sc-36241]
@khk-globus khk-globus added the quick-review Review of this should be quick and easy label Oct 8, 2024
Copy link
Member

@rjmello rjmello left a comment

Choose a reason for hiding this comment

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

This strikes a nice balance.

Copy link
Contributor

@LeiGlobus LeiGlobus left a comment

Choose a reason for hiding this comment

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

With the added 'raises ValueError' docstring and better error messaging including the 'correct' function_id, I agree that's enough handholding before the refusal, whereas previously it was too harsh and user-unfriendly.

Copy link
Collaborator

@yadudoc yadudoc left a comment

Choose a reason for hiding this comment

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

Nice! This is definitely better than not passing along the function id.

@khk-globus khk-globus merged commit 0e2744d into main Oct 8, 2024
11 checks passed
@khk-globus khk-globus deleted the sc-36241/improve_double_registration_error_message branch October 8, 2024 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
quick-review Review of this should be quick and easy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants