A tool to get a HLS video stream.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

37 lines
944 B

use std::{error, fmt};
use super::ClientActorMessageHandle;
#[derive(Debug)]
pub(crate) struct ClientError {
pub(super) action: ClientActorMessageHandle,
pub(super) source: Option<anyhow::Error>,
}
impl ClientError {
pub(super) fn new( action: ClientActorMessageHandle
, source: Option<anyhow::Error> ) -> Self {
let action = action.to_owned();
Self { action, source }
}
}
impl error::Error for ClientError {
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
match &self.source {
None => None,
Some(e) => Some(e.as_ref()),
}
}
}
impl fmt::Display for ClientError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match &self.source {
None => write!(f, "download error: {:?}", self.action),
Some(err) => write!(f, "download error ({:?}): {}", self.action, err),
}
}
}