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: {0}")]
9 VersionReadError(#[from] VersionError),
10
11 #[error("api hub config: '{0}' is missing")]
12 ConfigNotFound(String),
13
14 #[error("Unity Hub config directory missing")]
15 ConfigDirectoryNotFound,
16
17 #[error("Failed to locate application directory")]
18 ApplicationDirectoryNotFound {
19 #[source]
20 source: io::Error,
21 },
22
23 #[error("failed to read Unity Hub config {config}")]
24 ReadConfigError {
25 config: String,
26 source: anyhow::Error,
27 },
28
29 #[error("can't write Unity Hub config: '{config}'")]
30 WriteConfigError {
31 config: String,
32 source: anyhow::Error,
33 },
34
35 #[error("failed to create config directory")]
36 FailedToCreateConfigDirectory {
37 source: io::Error,
38 },
39
40 #[error("failed to create config file for config {config}")]
41 FailedToCreateConfig {
42 config: String,
43 source: io::Error
44 },
45
46 #[error("Unity Hub editor install path not found")]
47 InstallPathNotFound,
48
49 #[error("Failed to list installations at path {path}")]
50 FailedToListInstallations {
51 path: PathBuf,
52 source: io::Error
53 },
54
55 #[error("Installation with version {version} not found")]
56 InstallationNotFound {
57 version: String,
58 #[source]
59 source: io::Error,
60 },
61
62}