-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Display a warning for when we fail to write to the settings file #7950
Conversation
Alternative implementation: We wrap the call to This would mean we should update the |
I kind of like this better. Right now my concern with how you have it written is that you're only keying off the one It might just be nicer to adjust that existing json error message to take a format substring inside it and let the exception, as you describe, provide the details as it throws it up the stack from either the file load or the json work itself. |
src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw
Outdated
Show resolved
Hide resolved
} | ||
catch (...) | ||
{ | ||
throw SettingsTypedDeserializationException{ winrt::to_string((RS_(L"WriteSettingsFailed"))) }; |
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 this one -- SettingsTypedDeserializationException taking a string is because of laziness, not to signal that it is the right way to emit settings error text. I'd rather surface it through the existing mechanisms for settings warnings (which we do have!), if at all possible. Warnings are allocated resource strings in TerminalApp instead of TerminalSettingsModel, admittedly, but there's already code that handles displaying a dialog with a number of warnings in it 😄
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 know this conflicts with what @miniksa asked for, but we've got a long tradition of swallowing exceptions and presenting them to the user as "well something weird happened" here on Terminal. At least sending it up as a warning code (not an error!) DOES NOT discard the entire settings load operation!
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 agree with the above. Failing to write the file doesn't seem like the kind of thing that makes the entire settings unusable - we've got perfectly valid settings in fact, we just can't update the dynamic profiles. That's not world-ending, we can still run with that.
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.
Changed it to a warning now!
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.
This looks like how I'd do it, thanks!
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.
Love it
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: |
🎉 Handy links: |
We wrap the call to
_WriteSettings
inCascadiaSettingsSerialization.cpp
in a try/catch block, and if wecatch an error we append a warning telling the user to check the
permissions on their settings file.
Closes #7727