#[non_exhaustive]pub enum Error {
Show 24 variants
VersionUnsupported(String),
LockingDisabled(String),
Unauthorized(String),
Protocol(String),
LimitExceeded(String),
ChecksumMismatch(String),
ModeRefused(String),
MissingObjects {
message: String,
missing: Vec<ObjectName>,
},
RefMismatch {
message: String,
name: String,
current: Option<Checksum>,
},
NonFastForward(String),
DeleteDenied(String),
InvalidRef(String),
RefDenied(String),
SignatureRequired(String),
BindingMismatch(String),
Internal(String),
Aborted,
CommitOutcomeUnknown {
refs: Vec<String>,
message: String,
},
Source(Box<dyn Error + Send + Sync>),
InvalidInput(String),
Transport(String),
Fetch(Error),
Io(Error),
Walk {
path: PathBuf,
source: Error,
},
}Expand description
The error of each fallible operation of this crate.
A variant with a wire code matches one code of an Error message, for
example Error::Protocol for the code protocol. ErrorCode names
the codes. code returns the code of an error and lists the
variants that have no code.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
VersionUnsupported(String)
The server does not support the requested protocol version.
LockingDisabled(String)
The server repository sets [core] locking=false.
A refusal of the credential of an HTTP push session.
The client returns this variant for an Error message with the code
unauthorized. An ostrya server sends that message over HTTP alone,
with the status 401 or 403. A 401 or 403 whose body is not one frame
is Error::Transport.
Protocol(String)
A malformed frame, an unknown kind, or a message out of order.
LimitExceeded(String)
A frame, a batch, or a metadata object over its limit.
ChecksumMismatch(String)
An object whose bytes do not hash to its name.
ModeRefused(String)
Content that the server refuses to store.
The repository mode cannot store the content, or the content is privileged and the policy does not allow it.
MissingObjects
A commit that reaches objects that the server does not hold.
The objects are not in the repository and are not staged in the
session. missing lists them.
Fields
missing: Vec<ObjectName>The objects that are missing.
RefMismatch
A ref that is not in its expected state, or a ref that exists and that the update can create and not move.
The second case is an update that writes a commit to a ref that
exists, with t and no w on the ref, also when the commit is the
current commit. name and current give the current state.
current is None if the ref is absent.
Fields
NonFastForward(String)
A ref update that is not a fast-forward.
The new commit does not descend from the current tip, and the policy does not allow it.
DeleteDenied(String)
A ref delete that the policy does not allow.
InvalidRef(String)
A ref name that an ostrya server refuses.
RefDenied(String)
A session or a ref update that the policy refuses.
In a push session, these are the causes:
- The client group opens no push session.
- A ref of
Hellohas nor. - An update writes a commit to a ref with no
wand not. - An update names a ref that a push does not write: a remote ref, the collection anchor ref of a server with a collection id, a ref that is an alias, or a ref path that a ref write cannot replace.
- Two updates write a commit, and the ref of one names a directory of the other.
In a one-way stream, the rule that matches the update does not accept it, or the update names a remote ref that no rule matches.
SignatureRequired(String)
A commit with no trusted signature that verifies.
The policy requires a trusted signature.
BindingMismatch(String)
A commit whose bindings do not match the session.
The ostree.ref-binding of the commit does not name a target ref, or
its ostree.collection-binding does not name the collection id of the
server.
Internal(String)
A server-side failure, for example an I/O error.
Aborted
The client ended the session with Abort, or abandoned an object.
The client abandons an object with the abandon marker. No wire code
carries this variant, because the server sends no Error message in
reply.
CommitOutcomeUnknown
A Commit whose outcome is unknown.
The client sent Commit, and the session ended with no reply that the
client can read. The server can have written the refs, and the client
cannot know if it did. refs names the refs of the ref updates.
Fields
Source(Box<dyn Error + Send + Sync>)
A failure of the object source while the session sends its objects.
The session ends with Abort.
InvalidInput(String)
A call of the client that the session refuses.
The session refuses a call with an argument or source data that it cannot send. It also refuses a call while another call runs, and a call on a broken session.
Transport(String)
A failure of the transport under the session.
- Over ssh, the ssh client cannot start, or it exits with a failure status while the session fails with an I/O error. The message names the program.
- Over HTTP, the session cannot use the response of the server. The
message names the URL, and for the first three cases the status:
- a status that the receive endpoint does not give, a 3xx included
- a body that is not one frame
- a frame other than an
Errormessage with an error status - a
HelloReplywith no session id of 64 lowercase hex digits - a frame other than an
Errormessage in answer toDELETE
No wire code carries this variant.
Fetch(Error)
A failure of the HTTP client of the session.
The client cannot be built, a request cannot be sent, or a request fails after it is sent. No wire code carries this variant.
Io(Error)
An I/O error of the underlying stream.
An end of file inside a frame or an object has the kind
UnexpectedEof.
Walk
A failure of the walk or of the hash pass of a local tree.
If the send pass cannot open a file of the tree again, it also
returns this variant. path names the entry on the local filesystem,
the walk root included. source keeps the io::ErrorKind of the
failure.
TreeModel::scan lists the kinds in
its # Errors section.
No wire code carries this variant. The walk and the hash pass come
before any session. A session returns a failed open of the send pass
inside Error::Source.
Implementations§
Source§impl Error
impl Error
Sourcepub fn code(&self) -> Option<ErrorCode>
pub fn code(&self) -> Option<ErrorCode>
Returns the wire code of the error, or None for a variant with no code.
These variants have no wire code:
Sourcepub fn to_message(&self) -> ErrorMessage
pub fn to_message(&self) -> ErrorMessage
Returns the Error message that reports this error to the peer.
An error with no wire code reports as the code internal, with its
display text as the message.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<ErrorMessage> for Error
Converts an Error message from a server to the Error variant of its
code.
impl From<ErrorMessage> for Error
Converts an Error message from a server to the Error variant of its
code.
The conversion drops a missing list or a current state on a code that
does not carry one. A decoded ref-mismatch always carries its current
state, so Error::to_message gives the same message back.