persistence: More error contexts (#40787)

Release Notes:

- N/A *or* Added/Fixed/Improved ...

Co-authored-by: David Kleingeld <davidsk@zed.dev>
This commit is contained in:
Lukas Wirth
2025-10-21 11:29:43 +00:00
committed by GitHub
co-authored by David Kleingeld
parent 3d4abde55a
commit 0be70e24d6
4 changed files with 23 additions and 10 deletions
+5 -2
View File
@@ -24,7 +24,7 @@ use rpc::{
use std::{io, sync::Arc, time::Instant};
use text::{BufferId, ReplicaId};
use util::{ResultExt as _, TryFutureExt, debug_panic, maybe, rel_path::RelPath};
use util::{ResultExt as _, TryFutureExt, debug_panic, maybe, paths::PathStyle, rel_path::RelPath};
use worktree::{File, PathChange, ProjectEntryId, Worktree, WorktreeId};
/// A set of open buffers.
@@ -621,8 +621,11 @@ impl LocalBufferStore {
let load_file = worktree.load_file(path.as_ref(), cx);
let reservation = cx.reserve_entity();
let buffer_id = BufferId::from(reservation.entity_id().as_non_zero_u64());
let path = path.clone();
cx.spawn(async move |_, cx| {
let loaded = load_file.await?;
let loaded = load_file.await.with_context(|| {
format!("Could not open path: {}", path.display(PathStyle::local()))
})?;
let text_buffer = cx
.background_spawn(async move {
text::Buffer::new(ReplicaId::LOCAL, buffer_id, loaded.text)