summaryrefslogtreecommitdiffstats
path: root/vendor/gix/src/remote/errors.rs
blob: 34ed8246b24e60c76e5e131af38a34c04c1939f0 (plain)
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
///
pub mod find {
    use crate::{bstr::BString, config, remote};

    /// The error returned by [`Repository::find_remote(…)`](crate::Repository::find_remote()).
    #[derive(Debug, thiserror::Error)]
    #[allow(missing_docs)]
    pub enum Error {
        #[error("The value for 'remote.<name>.tagOpt` is invalid and must either be '--tags' or '--no-tags'")]
        TagOpt(#[from] config::key::GenericErrorWithValue),
        #[error("{kind} ref-spec under `remote.{remote_name}` was invalid")]
        RefSpec {
            kind: &'static str,
            remote_name: BString,
            source: config::refspec::Error,
        },
        #[error("Neither 'url` nor 'pushUrl' fields were set in the remote's configuration.")]
        UrlMissing,
        #[error("The {kind} url under `remote.{remote_name}` was invalid")]
        Url {
            kind: &'static str,
            remote_name: BString,
            source: config::url::Error,
        },
        #[error(transparent)]
        Init(#[from] remote::init::Error),
    }

    ///
    pub mod existing {
        use crate::bstr::BString;

        /// The error returned by [`Repository::find_remote(…)`](crate::Repository::find_remote()).
        #[derive(Debug, thiserror::Error)]
        #[allow(missing_docs)]
        pub enum Error {
            #[error(transparent)]
            Find(#[from] super::Error),
            #[error("remote name could not be parsed as URL")]
            UrlParse(#[from] gix_url::parse::Error),
            #[error("The remote named {name:?} did not exist")]
            NotFound { name: BString },
        }
    }

    ///
    pub mod for_fetch {
        /// The error returned by [`Repository::find_fetch_remote(…)`](crate::Repository::find_fetch_remote()).
        #[derive(Debug, thiserror::Error)]
        #[allow(missing_docs)]
        pub enum Error {
            #[error(transparent)]
            FindExisting(#[from] super::existing::Error),
            #[error(transparent)]
            FindExistingReferences(#[from] crate::reference::find::existing::Error),
            #[error("Could not initialize a URL remote")]
            Init(#[from] crate::remote::init::Error),
            #[error("remote name could not be parsed as URL")]
            UrlParse(#[from] gix_url::parse::Error),
            #[error("No configured remote could be found, or too many were available")]
            ExactlyOneRemoteNotAvailable,
        }
    }
}