1use std::path::StripPrefixError;
2
3use image::ImageError;
4use thiserror::Error;
5
6use crate::CliError;
7
8#[derive(Debug, Error)]
10pub enum IniError {
11 #[error("{0}")]
12 Io(#[from] std::io::Error),
13
14 #[error("Failed to parse ini syntax: {0}")]
15 ParseError(#[from] ini::Error),
16
17 #[error("Missing {0} section in INI file")]
18 MissingSection(String),
19
20 #[error("Missing specified file loaded upon install: {0}")]
21 MissingOnLoad(String),
22
23 #[error("{0}")]
24 CliError(#[from] CliError),
25}
26
27#[derive(Debug, Error)]
29pub enum ArchiveError {
30 #[error("{0}")]
31 Io(#[from] std::io::Error),
32
33 #[error("{0}")]
34 StripPrefixError(#[from] StripPrefixError),
35
36 #[error("{0}")]
37 ZipError(#[from] zip::result::ZipError),
38
39 #[error("invalid machine type ({0}) found for alleged plugin")]
40 InvalidPlugin(u16),
41}
42
43#[derive(Debug, Error)]
45pub enum RmSkinBuildError {
46 #[error("{0}")]
47 Io(#[from] std::io::Error),
48
49 #[error("{0}")]
50 ImageError(#[from] ImageError),
51
52 #[error("{0}")]
53 IniError(#[from] IniError),
54
55 #[error("{0}")]
56 CliError(#[from] CliError),
57
58 #[error("{0}")]
59 ArchiveError(#[from] ArchiveError),
60
61 #[error("Project is malformed. It must contain a RMSKIN.ini and a populated Skins folder")]
62 MalformedProject,
63}