use crate::Method;
use crate::state::SessionState;
pub type Result<T> = core::result::Result<T, Error>;
#[non_exhaustive]
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("failed to parse RTSP message: {0}")]
MessageParse(String),
#[error("failed to serialize RTSP message: {0}")]
MessageWrite(String),
#[error("method {method:?} not valid in state {state:?}")]
MethodNotValidInState {
method: Method,
state: SessionState,
},
#[error("no pending request for CSeq {0}")]
UnknownCSeq(u32),
#[error("response is missing a CSeq header")]
MissingCSeq,
#[error("no session established (SETUP not completed)")]
MissingSession,
#[error("invalid Transport header: {0}")]
TransportParse(String),
#[error("invalid interleaved frame: {0}")]
InterleavedFrame(String),
#[error("authentication failure: {0}")]
Auth(String),
#[error("request URI required but not set")]
MissingRequestUri,
#[error("socket IO error: {0}")]
Io(String),
#[error("TLS error: {0}")]
Tls(String),
}