Skip to content

Commit 1c5c855

Browse files
authored
Show actual error in InvalidBufferView (#37657)
Release Notes: - Update error view to show the error
1 parent 5d37419 commit 1c5c855

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

crates/workspace/src/invalid_buffer_view.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ use std::{path::Path, sync::Arc};
33
use gpui::{EventEmitter, FocusHandle, Focusable};
44
use ui::{
55
App, Button, ButtonCommon, ButtonStyle, Clickable, Context, FluentBuilder, InteractiveElement,
6-
KeyBinding, ParentElement, Render, SharedString, Styled as _, Window, h_flex, v_flex,
6+
KeyBinding, Label, LabelCommon, LabelSize, ParentElement, Render, SharedString, Styled as _,
7+
Window, h_flex, v_flex,
78
};
89
use zed_actions::workspace::OpenWithSystem;
910

@@ -30,7 +31,7 @@ impl InvalidBufferView {
3031
Self {
3132
is_local,
3233
abs_path: Arc::from(abs_path),
33-
error: format!("{e}").into(),
34+
error: format!("{}", e.root_cause()).into(),
3435
focus_handle: cx.focus_handle(),
3536
}
3637
}
@@ -88,7 +89,12 @@ impl Render for InvalidBufferView {
8889
v_flex()
8990
.justify_center()
9091
.gap_2()
91-
.child(h_flex().justify_center().child("Unsupported file type"))
92+
.child(h_flex().justify_center().child("Could not open file"))
93+
.child(
94+
h_flex()
95+
.justify_center()
96+
.child(Label::new(self.error.clone()).size(LabelSize::Small)),
97+
)
9298
.when(self.is_local, |contents| {
9399
contents.child(
94100
h_flex().justify_center().child(

0 commit comments

Comments
 (0)