-
Notifications
You must be signed in to change notification settings - Fork 80
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
feat: better error messages on malformed option value #798
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #798 +/- ##
==========================================
- Coverage 59.68% 59.60% -0.08%
==========================================
Files 210 210
Lines 7639 7684 +45
==========================================
+ Hits 4559 4580 +21
- Misses 2437 2459 +22
- Partials 643 645 +2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way we can validate the config once at startup instead of doing this whenever one wants to access an option?
We could run this method one time for each option on startup (or on the first |
My primary concern is not the performance, but rather that it is very annoying to check for an error every time you access the config. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As much as I would like to see the error handling to be gone, I think we can merge this for now.
🤖 I have created a release *beep* *boop* --- ## [1.45.0](v1.44.2...v1.45.0) (2024-07-17) ### Features * allow configuring default sort columns for each supported resource ([#795](#795)) ([f6877a1](f6877a1)) * better error messages on malformed option value ([#798](#798)) ([8c6fec9](8c6fec9)) ### Bug Fixes * **config:** ordering of list option values not preserved ([#805](#805)) ([1ac27bf](1ac27bf)) * debug log is truncated if it already exists ([#793](#793)) ([c3d3a9f](c3d3a9f)) * **firewall:** wrong wording when firewall is removed from resource ([#812](#812)) ([9017a65](9017a65)), closes [#809](#809) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Previously, if an option was configured with the wrong type (e.g.
string
was configured with anint
value) or other parsing errors like malformed duration/boolean values occured,Option[T].Get()
would panic. It now returns an error that can properly be displayed to the user and falls back to the default value.