feat(errors): better download manager errors + modal

This commit is contained in:
DecDuck
2024-12-26 12:56:54 +11:00
parent 85a08990c3
commit ad92dbec08
5 changed files with 31 additions and 3 deletions

View File

@ -1,4 +1,5 @@
use std::{
error::Error,
fmt::{Display, Formatter},
sync::{Arc, Mutex},
};
@ -26,7 +27,16 @@ pub enum RemoteAccessError {
impl Display for RemoteAccessError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
RemoteAccessError::FetchError(error) => write!(f, "{}", error),
RemoteAccessError::FetchError(error) => write!(
f,
"{}: {}",
error,
error
.source()
.map(|e| e.to_string())
.or_else(|| Some("Unknown error".to_string()))
.unwrap()
),
RemoteAccessError::ParsingError(parse_error) => {
write!(f, "{}", parse_error)
}