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.
lolistealer/src/work_async/progress/error.rs

41 lines
648 B

use tokio::{
sync::{
mpsc::{
error::SendError,
},
},
};
use std::{
fmt,
};
#[derive(Debug)]
pub enum Error
{
SendError,
RecvError,
Unknown,
}
impl std::error::Error for Error{}
impl fmt::Display for Error
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
{
write!(f, "sync (fatal): ")?;
match self {
Error::SendError => write!(f, "there was an mpsc send error"),
Error::RecvError => write!(f, "there was an mpsc recv error"),
_ => write!(f, "unknown error"),
}
}
}
impl<T> From<SendError<T>> for Error
{
fn from(_er: SendError<T>) -> Self
{
Error::SendError
}
}