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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
use std::path::PathBuf;

error_chain! {
    foreign_links {
        Io(::std::io::Error) #[doc = "An error from the std::io module"];
        Git(::git2::Error)#[doc = "An error from the git2 crate"];
        CargoMetadata(::failure::Compat<::cargo_metadata::Error>)#[doc = "An error from the cargo_metadata crate"];
    }

    errors {
        /// Failed to read home directory
        ReadHomeDirFailure {
            description("Failed to read home directory")
        }
        /// Invalid JSON in registry index
        InvalidSummaryJson {
            description("Invalid JSON in registry index")
        }
        /// Given crate name is empty
        EmptyCrateName{
            description("Found empty crate name")
        }
        /// No crate by that name exists
        NoCrate(name: String) {
            description("The crate could not be found in registry index.")
            display("The crate `{}` could not be found in registry index.", name)
        }
        /// No versions available
        NoVersionsAvailable {
            description("No available versions exist. Either all were yanked \
                         or only prerelease versions exist. Trying with the \
                         --allow-prerelease flag might solve the issue."
            )
        }
        /// Unable to parse external Cargo.toml
        ParseCargoToml {
            description("Unable to parse external Cargo.toml")
        }
        /// Cargo.toml could not be found.
        MissingManifest {
            description("Unable to find Cargo.toml")
        }
        /// Cargo.toml is valid toml, but doesn't contain the expected fields
        InvalidManifest {
            description("Cargo.toml missing expected `package` or `project` fields")
        }
        /// Found a workspace manifest when expecting a normal manifest
        UnexpectedRootManifest {
            description("Found virtual manifest, but this command requires running against an \
                         actual package in this workspace.")
        }
        /// The TOML table could not be found.
        NonExistentTable(table: String) {
            description("non existent table")
            display("The table `{}` could not be found.", table)
        }
        /// The dependency could not be found.
        NonExistentDependency(name: String, table: String) {
            description("non existent dependency")
            display("The dependency `{}` could not be found in `{}`.", name, table)
        }
        /// Config of cargo is invalid
        InvalidCargoConfig {
            description("Invalid cargo config")
        }
        /// Unable to find the source specified by 'replace-with'
        NoSuchSourceFound(name: String) {
            description("Unable to find the source specified by 'replace-with'")
            display("The source '{}' could not be found", name)
        }
        /// Unable to find the specified registry
        NoSuchRegistryFound(name: String) {
            display("The registry '{}' could not be found", name)
        }
        /// Failed to parse a version for a dependency
        ParseVersion(version: String, dep: String) {
            description("Failed to parse a version for a dependency")
            display("The version `{}` for the dependency `{}` couldn't be parsed", version, dep)
        }
        /// Missing registrary checkout in the cargo registrary
        MissingRegistraryCheckout(path: PathBuf) {
            description("Missing registrary checkout in the cargo registrary")
            display("Looks like ({}) is empty", path.display())
        }
        /// Non Unicode git path
        NonUnicodeGitPath {
            // this is because git2 function takes &str insted of something like AsRef<Path>
            description("Path to cargos registrary contains non unicode characters")
        }
    }
}