-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Add serialization error handling to settings projection layer #7576
Conversation
Note to ReviewersFeel free to review this before #7457. It's an awkward size that's...
So I'm fine either way. |
641e1c7
to
1885822
Compare
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.
Looks fine to me. Rather mechanical. If it works, it works.
98d08a9
to
eecd112
Compare
catch (const SettingsException& ex) | ||
{ | ||
auto settings = winrt::get_self<implementation::CascadiaSettings>(LoadDefaults()); | ||
settings->_loadError = ex.Error(); | ||
return *settings; | ||
} | ||
catch (const SettingsTypedDeserializationException& e) | ||
{ | ||
auto settings = winrt::get_self<implementation::CascadiaSettings>(LoadDefaults()); | ||
std::string_view what{ e.what() }; |
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.
i'm not in love with the number of copies of this "fall back to the defaults" code there are now. this is interesting ...
it's a process that can fail, and we need a way to claw an object back out of it just to hang errors off of it.
when the consumer gets an error, what is it going to do? call LoadDefaults again?
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.
Yeah. I could probably get away with just returning a blank CascadiaSettings
instead? Especially since the first thing the consumer does is "if loading the settings failed --> load defaults --> display error/warning message"
This is all absolutely awful.
Hello @DHowett! 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: |
Now that CascadiaSettings is a WinRT object, we need to update the error
handling a bit. Making it a WinRT object limits our errors to be
hresults. So we moved all the error handling down a layer to when we
load the settings object.
Warnings()
.GetLoadingError()
.GetSerializationErrorMessage()
.References
#7141 - CascadiaSettings is a settings object
#885 - this makes ripping out CascadiaSettings into
TerminalSettingsModel much easier
Validation Steps Performed