1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use std::{
    io,
    path::{Path, PathBuf},
};

use thiserror::Error;

use crate::model::Mod;

#[derive(Error, Debug)]
pub enum ThermiteError {
    #[error("Error while installing mod {0}", m.name)]
    InstallError {
        m: Box<Mod>,
        path: Box<Path>,
        source: Box<dyn std::error::Error + Send + Sync>,
    },
    #[error("No such file {0:?}")]
    MissingFile(PathBuf),
    #[error(transparent)]
    IoError(#[from] io::Error),
    #[error("Error parsing RON")]
    RonError(#[from] ron::Error),
    #[error("{0}")]
    MiscError(String),
    #[error("Error downloading file: {0}")]
    DownloadError(#[from] reqwest::Error),
    #[error(transparent)]
    ZipError(#[from] zip::result::ZipError),
    #[error("Error parsing JSON: {0}")]
    JsonError(#[from] serde_json::Error),
    #[error("Error resolving dependency {0}")]
    DepError(String),
}