settings: Follow-up fix to show more errors (#18123)

The condition added in #18122 was too strict.


Release Notes:

- N/A
This commit is contained in:
Thorsten Ball 2024-09-20 11:10:19 +02:00 committed by GitHub
parent ace4d5185d
commit 97708fdf43
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -629,15 +629,17 @@ fn handle_settings_changed(error: Option<anyhow::Error>, cx: &mut AppContext) {
for workspace in workspace::local_workspace_windows(cx) { for workspace in workspace::local_workspace_windows(cx) {
workspace workspace
.update(cx, |workspace, cx| { .update(cx, |workspace, cx| {
match error match error.as_ref() {
.as_ref() Some(error) => {
.and_then(|error| error.downcast_ref::<InvalidSettingsError>()) if let Some(InvalidSettingsError::LocalSettings { .. }) =
error.downcast_ref::<InvalidSettingsError>()
{ {
Some(InvalidSettingsError::UserSettings { message }) => { // Local settings will be displayed by the projects
} else {
workspace.show_notification(id.clone(), cx, |cx| { workspace.show_notification(id.clone(), cx, |cx| {
cx.new_view(|_| { cx.new_view(|_| {
MessageNotification::new(format!( MessageNotification::new(format!(
"Invalid user settings file\n{message}" "Invalid user settings file\n{error}"
)) ))
.with_click_message("Open settings file") .with_click_message("Open settings file")
.on_click(|cx| { .on_click(|cx| {
@ -647,8 +649,8 @@ fn handle_settings_changed(error: Option<anyhow::Error>, cx: &mut AppContext) {
}) })
}); });
} }
}
None => workspace.dismiss_notification(&id, cx), None => workspace.dismiss_notification(&id, cx),
_ => {}
} }
}) })
.log_err(); .log_err();