use crate::{
fs_utils::{EscapedDisplayText, FileReadError, FileWriteError},
text_stream::TextStreamError,
};
use std::path::PathBuf;
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum BufferOpenError {
#[error("{0}")]
File(#[from] FileReadError),
#[error("{} is not valid editor text: {source}", EscapedDisplayText::from_path(path).as_str())]
Text {
path: PathBuf,
#[source]
source: TextStreamError,
},
}
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum BufferWriteError {
#[error("buffer has no file name")]
NoFileName,
#[error("{0}")]
File(#[from] FileWriteError),
}