1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum BufferError {
5 #[error("io: {0}")]
6 Io(#[from] std::io::Error),
7 #[error("invalid position {line}:{column} — buffer has {total_lines} line(s)")]
8 InvalidPosition {
9 line: u32,
10 column: u32,
11 total_lines: u32,
12 },
13 #[error("invalid range {start}..{end}")]
14 InvalidRange { start: String, end: String },
15 #[error("buffer has no path — save requires a path")]
16 NoPath,
17 #[error("nothing to undo")]
18 NothingToUndo,
19 #[error("nothing to redo")]
20 NothingToRedo,
21}