1use std::io;
2use std::path::PathBuf;
3use thiserror::Error;
4use unity_version::error::VersionError;
5pub use crate::unity::error::*;
6#[derive(Error, Debug)]
7pub enum UnityHubError {
8 #[error("Unity Version error")]
9 VersionReadError(#[from] VersionError),
10
11 #[error("IO error")]
12 IoError(#[from] io::Error),
13
14 #[error("api hub config: '{0}' is missing")]
15 ConfigNotFound(String),
16
17 #[error("Unity Hub config directory missing")]
18 ConfigDirectoryNotFound,
19
20 #[error("failed to read Unity Hub config {config}")]
21 ReadConfigError {
22 config: String,
23 source: anyhow::Error,
24 },
25
26 #[error("can't write Unity Hub config: '{config}'")]
27 WriteConfigError {
28 config: String,
29 source: anyhow::Error,
30 },
31
32 #[error("failed to create config directory")]
33 FailedToCreateConfigDirectory {
34 source: io::Error,
35 },
36
37 #[error("failed to create config file for config {config}")]
38 FailedToCreateConfig {
39 config: String,
40 source: io::Error
41 },
42
43 #[error("Unity Hub editor install path not found")]
44 InstallPathNotFound,
45
46 #[error("Failed to list installations at path {path}")]
47 FailedToListInstallations {
48 path: PathBuf,
49 source: io::Error
50 }
51
52}