refactor!: moved quest::error::QuestError to crate::error::Error

This commit is contained in:
Alexey 2025-12-01 17:15:08 +03:00
commit 1dc7d94785
5 changed files with 49 additions and 22 deletions

View file

@ -3,7 +3,7 @@
use std::{fs::{self, DirEntry},path::{Path, PathBuf}};
use serde::Deserialize;
use crate::quest::{Quest,error::QuestError};
use crate::{error::Error,quest::Quest};
/// Struct for containing paths to other (de-)serializable things
#[derive(Deserialize)]
@ -34,17 +34,17 @@ impl Default for Config {
}
}
fn handle_quest_entry(quest_entry: DirEntry) -> Result<Quest, QuestError>{
fn handle_quest_entry(quest_entry: DirEntry) -> Result<Quest, Error>{
let filetype = quest_entry.file_type();
if let Err(error) = filetype {
return Err(QuestError::IoError(error));
return Err(Error::IoError(error));
}
let path = quest_entry.path();
let filetype = filetype.unwrap();
if !filetype.is_file() {
return Err(QuestError::IsNotAFile(path));
return Err(Error::IsNotAFile(path));
}
Quest::load(path)