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 ParseException when a configuration setting can't be parsed as the type requested #735

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

rgallardo-netflix
Copy link
Contributor

Homogenize the handling of parsing errors. Before this change, some code paths in the default Property implementation would silently swallow parsing errors and either return a defaultValue or null (even for non-nullable methods!) This leads to errors that are hard to debug.

Throwing a ParseException is a behavior change that will simplify debugging at the expense of surfacing latent bugs in user code. For example, if bad values are being set in config files, the code will now fail instead of silently returning a different value than expected.

…the type requested.

Homogenize the handling of parsing errors. Before this change, some code paths in the default Property implementation would silently swallow parsing errors and either return a defaultValue or null (even for non-nullable methods!) This leads to errors that are hard to debug.

Throwing a ParseException is a behaviour change that will lead to simpler debugging, at the expense of surfacing latent bugs in user code. For example, if bad values were being set in config files, the code will now fail instead of silently returning a different value than expected.
Copy link
Contributor

@akang31 akang31 left a comment

Choose a reason for hiding this comment

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

LGTM!

Updated PropertyImpl looks good [x]
Error log is updated to indicate new behavior [x]
Test for the Property.orElse case [x]

@rgallardo-netflix rgallardo-netflix merged commit dfb7e88 into 2.x Sep 26, 2024
10 checks passed
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.

3 participants