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.
30 lines
769 B
30 lines
769 B
use std::{error, fmt};
|
|
|
|
use super::message::ClientActorMessageHandle;
|
|
|
|
|
|
#[derive(Debug)]
|
|
pub(crate) struct ClientActorError {
|
|
pub(super) action: ClientActorMessageHandle,
|
|
pub(super) source: anyhow::Error,
|
|
}
|
|
|
|
impl ClientActorError {
|
|
pub(super) fn new( action: &ClientActorMessageHandle
|
|
, source: anyhow::Error ) -> Self {
|
|
let action = action.to_owned();
|
|
Self { action, source }
|
|
}
|
|
}
|
|
|
|
impl error::Error for ClientActorError {
|
|
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
|
|
Some(self.source.as_ref())
|
|
}
|
|
}
|
|
|
|
impl fmt::Display for ClientActorError {
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
write!(f, "download error ({:?}): {}", self.action, self.source)
|
|
}
|
|
}
|