#[non_exhaustive]pub enum Error {
Show 26 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,
},
#[non_exhaustive] S3 {
status: u16,
code: Option<String>,
message: Option<String>,
key: Option<String>,
},
#[non_exhaustive] S3Region {
bucket: String,
region: String,
bucket_region: String,
},
}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.
With the s3 feature, the bucket client returns this variant for an
object over the size limit of the caller, for a listing page over
4 MiB, and for a body of Bucket::put_stream that is longer than
10,000 parts. s3::part_size returns it for a part size over 5 GiB.
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.
With the s3 feature, the s3 module returns this variant for a
refused value: a key pair, a region, a profile name, a setting of an
environment variable, or a shared AWS file that is larger than 1 MiB
or that the reader of the files refuses. It also returns it when no
source gives a key pair. The message holds no secret access key and no
session token. It also returns it for a refused address of a bucket
repository, endpoint URL, or location, for a key that is not a key of
a bucket repository, for a refused list prefix, for a part size
outside the range of 5 MiB to 5 GiB, and for an empty upload id.
Endpoint::parse returns this
variant for an s3:// address. The session constructors return it
for an S3 endpoint.
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
- With the
s3feature, the bucket client cannot use a listing: the XML reader refuses the body, a truncated page has no marker of the next page, a page does not move past the earlier pages, or a key is outside the prefix of the request. - With the
s3feature, the server answers a read or a list of the bucket client with 304. The request sends no validators, so the answer cannot be used. - With the
s3feature, the bucket client cannot use an answer of a multipart upload: the answer that starts the upload has no upload id, an upload id of more than 1 KiB, or no body, the answer to a part has noETagor anETagof more than 1 KiB, or the body of the answer that completes the upload cannot be read. - With the
s3feature, a completion of a multipart upload whose outcome is not known gets a 404NoSuchUpload, and the key holds no object or an object of another length.
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. With the s3 feature, the bucket client
returns this variant for the same failures. 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.
With the s3 feature, the s3 module returns this variant for a
shared AWS file that exists and cannot be read. The error keeps the
io::ErrorKind of the failure, and its message names the file and the
path. The bucket client returns it for a failed read of the body of
Bucket::put_stream, with the error of the reader unchanged.
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.
Fields
#[non_exhaustive]S3
s3 only.An error response of an S3 server to a request of the bucket client.
code and message come from the Code and the Message elements
of the S3 Error document in the body. Both are None if the body
holds no such document, is larger than 4 MiB, declares a coding, or
did not arrive.
code and message have each control character and each format
character (Unicode categories Cc and Cf) replaced with U+FFFD, and
each holds at most 512 bytes.
The bucket client also returns this variant for an Error document
that S3 sends with a 2xx status. Then status is that status.
The message names the code RequestTimeTooSkewed and states that the
clock of this host is not in step with the clock of the server. A
wrong secret access key gives the code SignatureDoesNotMatch.
No wire code carries this variant.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]S3Region
s3 only.A bucket in a region other than the region of the signature.
The bucket client returns this variant for an unsuccessful response
whose x-amz-bucket-region header, or whose Region element of the
S3 Error document, names a region other than the region of the
location.
No wire code carries this variant.
Fields
This variant is marked as non-exhaustive
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:
Error::AbortedError::CommitOutcomeUnknownError::SourceError::InvalidInputError::TransportError::FetchError::IoError::WalkError::S3andError::S3Region, with thes3feature
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.