2025-10-27 16:10:57 +01:00
|
|
|
use std::io;
|
|
|
|
|
|
|
|
|
|
#[derive(thiserror::Error, Debug)]
|
|
|
|
|
pub enum FlacError {
|
|
|
|
|
#[error("I/O error: {0}")]
|
|
|
|
|
Io(#[from] io::Error),
|
|
|
|
|
#[error("FLAC decode error: {0}")]
|
|
|
|
|
Decode(String),
|
|
|
|
|
#[error("FLAC encode error: {0}")]
|
|
|
|
|
Encode(String),
|
|
|
|
|
#[error("libFLAC initialization failed: {0}")]
|
|
|
|
|
LibFlacInit(String),
|
|
|
|
|
#[error("libFLAC write callback failed: {0}")]
|
|
|
|
|
LibFlacWrite(String),
|
|
|
|
|
#[error("internal channel closed unexpectedly")]
|
|
|
|
|
ChannelClosed,
|
|
|
|
|
#[error("unsupported configuration: {0}")]
|
|
|
|
|
Unsupported(String),
|
|
|
|
|
#[error("{role} task failed: {details}")]
|
|
|
|
|
TaskJoin { role: &'static str, details: String },
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl From<claxon::Error> for FlacError {
|
|
|
|
|
fn from(err: claxon::Error) -> Self {
|
|
|
|
|
FlacError::Decode(err.to_string())
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-10-27 18:13:50 +01:00
|
|
|
|
|
|
|
|
impl From<String> for FlacError {
|
|
|
|
|
fn from(msg: String) -> Self {
|
|
|
|
|
FlacError::Decode(msg)
|
|
|
|
|
}
|
|
|
|
|
}
|