use std::path::PathBuf;
use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum MultimuxError {
#[error("failed to read config file {path:?}: {source}")]
ConfigRead {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("failed to parse config file {path:?}: {reason}")]
ConfigParse {
path: PathBuf,
reason: String,
},
#[error("invalid config field {field:?}: {reason}")]
ConfigInvalid {
field: &'static str,
reason: String,
},
#[error("connect failed: {reason}")]
Connect {
reason: String,
},
#[error("{phase} failed: {reason}")]
Protocol {
phase: &'static str,
reason: String,
},
#[error("SDP error: {reason}")]
Sdp {
reason: String,
},
#[error("authentication error: {reason}")]
Auth {
reason: String,
},
#[error("depayload error: {reason}")]
Depay {
reason: String,
},
#[error("transmux: {0}")]
Transmux(#[from] transmux::Error),
#[error("io: {0}")]
Io(#[from] std::io::Error),
#[error("unknown {kind} scheme {tag:?} — no factory registered")]
UnknownScheme {
kind: &'static str,
tag: String,
},
}
pub type Result<T> = core::result::Result<T, MultimuxError>;