Skip to main content

dsf/
error.rs

1use std::io;
2
3/// Errors produced by this crate.
4#[derive(Debug, thiserror::Error)]
5#[non_exhaustive]
6pub enum Error {
7    /// Underlying I/O failure.
8    #[error("I/O error: {0}")]
9    Io(#[from] io::Error),
10    /// A chunk signature did not match the DSF specification.
11    #[error("not a DSF file: bad `{0}` chunk signature")]
12    BadSignature(&'static str),
13    /// The file violates the DSF layout.
14    #[error("malformed DSF: {0}")]
15    Malformed(&'static str),
16    /// The embedded ID3v2 tag could not be parsed or written.
17    #[error("ID3 error: {0}")]
18    Id3(#[from] id3::Error),
19    /// A frame id was not a valid four-character ID3v2 text frame.
20    #[error("invalid text frame id {0:?} (expected e.g. \"TIT2\"; TXXX is not supported)")]
21    InvalidFrameId(String),
22}
23
24/// Crate-wide result alias.
25pub type Result<T> = std::result::Result<T, Error>;