1use failure::Fail;
2
3#[derive(Debug, Fail)]
4pub enum Error {
5 #[fail(display = "Failed to access the data directory")]
6 DataDirectoryAccessDenied,
7 #[fail(display = "Another Soma instance is using the data directory")]
8 DataDirectoryLockFailed,
9 #[fail(display = "Failed to build docker image for a problem")]
10 DockerBuildFailed,
11 #[fail(display = "A repository with the same name already exists")]
12 DuplicateRepository,
13 #[fail(display = "Failed to detect filename from the path")]
14 FileNameNotFound,
15 #[fail(
16 display = "The specified file does not exist, or you don't have enough permission to access it"
17 )]
18 FileUnreachable,
19 #[fail(display = "Some entry in the manifest is invalid")]
20 InvalidManifest,
21 #[fail(display = "The provided repository does not contain 'soma.toml' or 'soma-list.toml'")]
22 InvalidRepository,
23 #[fail(display = "soma-list.toml contains a duplicate or inaccessible entry")]
24 InvalidSomaList,
25 #[fail(
26 display = "The name doesn't satisfy docker name component rules, which allows lower case alphanumerics with non-boundary '_', '__', or (multiple) '-'(s)"
27 )]
28 InvalidName,
29 #[fail(display = "The specified file's path contains unsupported characters")]
30 InvalidUnicode,
31 #[fail(display = "There is a container already running for the specified problem")]
32 ProblemAlreadyRunning,
33 #[fail(display = "The specified problem is not found")]
34 ProblemNotFound,
35 #[fail(display = "There is no container running for the specified problem")]
36 ProblemNotRunning,
37 #[fail(display = "The provided query returned multiple problems")]
38 ProblemQueryAmbiguous,
39 #[fail(display = "There is an image or an container from the repository")]
40 RepositoryInUse,
41 #[fail(display = "The specified repository is not found")]
42 RepositoryNotFound,
43 #[fail(
44 display = "The repository contains changes that cannot be handled by update command; Please remove and add the repository manually"
45 )]
46 UnsupportedUpdate,
47}
48
49pub type Result<T> = std::result::Result<T, failure::Error>;