feat: better error messages

Provide "No such file or directory" error if file is not found.
Provide "Unknown Error" if other error found

Should reduce confusion from the generic other error
This commit is contained in:
andy.boot
2024-01-03 23:07:06 +00:00
parent cd53fc7494
commit e80892a9e7
4 changed files with 112 additions and 51 deletions
+9 -2
View File
@@ -1,8 +1,9 @@
use std::{
collections::HashSet,
io::Write,
path::Path,
sync::{
atomic::{AtomicBool, AtomicU64, AtomicU8, AtomicUsize, Ordering},
atomic::{AtomicU64, AtomicU8, AtomicUsize, Ordering},
mpsc::{self, RecvTimeoutError, Sender},
Arc, RwLock,
},
@@ -55,7 +56,6 @@ pub struct PAtomicInfo {
pub total_file_size: AtomicU64,
pub state: AtomicU8,
pub current_path: ThreadStringWrapper,
pub no_permissions: AtomicBool,
}
impl PAtomicInfo {
@@ -68,6 +68,13 @@ impl PAtomicInfo {
}
}
#[derive(Default)]
pub struct RuntimeErrors {
pub no_permissions: bool,
pub file_not_found: HashSet<String>,
pub unknown_error: HashSet<String>,
}
/* -------------------------------------------------------------------------- */
fn format_preparing_str(prog_char: char, data: &PAtomicInfo, is_iso: bool) -> String {