Skip to main content

osc7501_parser/
error.rs

1use crate::Limit;
2
3/// Failure to validate a value, parse OSC 7501 input, or decode its text.
4#[derive(Clone, Copy, Debug, Eq, PartialEq, thiserror::Error)]
5#[non_exhaustive]
6pub enum Error {
7    /// Invalid application identifier grammar or length.
8    #[error("invalid application identifier")]
9    InvalidAppId,
10    /// Invalid record identifier grammar, length, or depth.
11    #[error("invalid record identifier")]
12    InvalidRecordId,
13    /// A percentage exceeds 100.
14    #[error("progress must be between 0 and 100")]
15    InvalidProgress,
16    /// Not exactly one complete OSC 7501 sequence.
17    #[error("invalid OSC 7501 framing")]
18    Framing,
19    /// A hard protocol cap was exceeded.
20    #[error("OSC 7501 {0:?} limit exceeded")]
21    Limit(Limit),
22    /// The caller's text destination does not have enough capacity.
23    #[error("text destination too small")]
24    BufferTooSmall,
25    /// Invalid base64 alphabet, padding, length, or nonzero unused bits.
26    #[error("invalid base64 text")]
27    InvalidBase64,
28    /// Decoded bytes are not valid UTF-8.
29    #[error("invalid UTF-8 text")]
30    InvalidUtf8,
31    /// Decoded text contains a C0, DEL, or C1 control character.
32    #[error("control character in text")]
33    ControlCharacter,
34}