Skip to main content

continuity_buffer/
error.rs

1//! Errors for the `continuity-buffer` crate.
2
3use thiserror::Error;
4
5/// Errors that can arise while operating on a `Buffer`.
6#[derive(Debug, Error)]
7pub enum Error {
8    /// An edit was applied against a revision that is no longer current.
9    #[error("stale revision {applied} (current {current})")]
10    StaleRevision {
11        /// The revision the edit targeted.
12        applied: u64,
13        /// The buffer's current revision.
14        current: u64,
15    },
16
17    /// Attempted to apply an edit to a read-only buffer (e.g. the
18    /// tutorial tab). Surfaced to the user as a transient banner; the
19    /// rope is never touched.
20    #[error("buffer is read-only")]
21    ReadOnly,
22
23    /// An error originating from the `text` crate.
24    #[error(transparent)]
25    Text(#[from] continuity_text::Error),
26}