#
rustfix/
error.rs

    1//! Error types.
    2
    3use std::ops::Range;
    4
    5#[non_exhaustive]
    6#[derive(Debug, thiserror::Error)]
    7pub enum Error {
    8    #[error("invalid range {0:?}, start is larger than end")]
    9    InvalidRange(Range<usize>),
    10
    11    #[error("invalid range {0:?}, original data is only {1} byte long")]
    12    DataLengthExceeded(Range<usize>, usize),
    13
    14    #[non_exhaustive]
    15    #[error("cannot replace slice of data that was already replaced")]
    16    AlreadyReplaced {
    17        /// The location of the intended replacement.
    18        range: Range<usize>,
    19        /// Whether the modification exactly matches (both range and data) the one it conflicts with.
    20        /// Some clients may wish to simply ignore this condition.
    21        is_identical: bool,
    22    },
    23
    24    #[error(transparent)]
    25    Utf8(#[from] std::string::FromUtf8Error),
    26}