-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Gracefully handle json data with the wrong value types #4961
Conversation
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.
Json::Utils
is awesome
…rong-settings-types # Conflicts: # src/cascadia/TerminalApp/Profile.cpp
Hello @DHowett-MSFT! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
🎉 Handy links: |
Summary of the Pull Request
Currently, if the Terminal attempts to parse a setting that should be a
bool
and the user provided a string, then we'll throw an exception while parsing the
settings, and display an error message that's pretty unrelated to the actual
problem.
The same goes for
bool
s asint
s,float
s asint
s, etc.This PR instead updates our settings parsing to ensure that we check the type of
a json value before actually trying to get its parsed value.
References
PR Checklist
Detailed Description of the Pull Request / Additional comments
I made a bunch of
JsonUtils
helpers for this in the same vein as theGetOptionalValue
ones.Notably, any other value type can safely be treated as a string value.
Validation Steps Performed