gix_protocol/fetch/
error.rs

1/// The error returned by [`fetch()`](crate::fetch()).
2#[derive(Debug, thiserror::Error)]
3#[allow(missing_docs)]
4pub enum Error {
5    #[error("Could not decode server reply")]
6    FetchResponse(#[from] crate::fetch::response::Error),
7    #[error(transparent)]
8    Negotiate(#[from] crate::fetch::negotiate::Error),
9    #[error(transparent)]
10    Client(#[from] crate::transport::client::Error),
11    #[error("Server lack feature {feature:?}: {description}")]
12    MissingServerFeature {
13        feature: &'static str,
14        description: &'static str,
15    },
16    #[error("Could not write 'shallow' file to incorporate remote updates after fetching")]
17    WriteShallowFile(#[from] gix_shallow::write::Error),
18    #[error("Could not read 'shallow' file to send current shallow boundary")]
19    ReadShallowFile(#[from] gix_shallow::read::Error),
20    #[error("'shallow' file could not be locked in preparation for writing changes")]
21    LockShallowFile(#[from] gix_lock::acquire::Error),
22    #[error("Receiving objects from shallow remotes is prohibited due to the value of `clone.rejectShallow`")]
23    RejectShallowRemote,
24    #[error("Failed to consume the pack sent by the remote")]
25    ConsumePack(#[source] Box<dyn std::error::Error + Send + Sync + 'static>),
26    #[error("Failed to read remaining bytes in stream")]
27    ReadRemainingBytes(#[source] std::io::Error),
28}
29
30impl crate::transport::IsSpuriousError for Error {
31    fn is_spurious(&self) -> bool {
32        match self {
33            Error::FetchResponse(err) => err.is_spurious(),
34            Error::Client(err) => err.is_spurious(),
35            _ => false,
36        }
37    }
38}