Skip to main content

Error

Enum Error 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

VersionUnsupported(String)

The server does not support the requested protocol version.

§

LockingDisabled(String)

The server repository sets [core] locking=false.

§

Unauthorized(String)

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

§message: String

The message for a human.

§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

§message: String

The message for a human.

§name: String

The name of the ref.

§current: Option<Checksum>

The current commit of the ref.

§

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 Hello has no r.
  • An update writes a commit to a ref with no w and no t.
  • 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

§refs: Vec<String>

The refs of the ref updates.

§message: String

A message for a human that states what ended the session.

§

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 Error message with an error status
    • a HelloReply with no session id of 64 lowercase hex digits
    • a frame other than an Error message in answer to DELETE
  • With the s3 feature, 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 s3 feature, 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 s3 feature, 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 no ETag or an ETag of more than 1 KiB, or the body of the answer that completes the upload cannot be read.
  • With the s3 feature, a completion of a multipart upload whose outcome is not known gets a 404 NoSuchUpload, 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

§path: PathBuf

The entry on the local filesystem.

§source: Error

The I/O error, with the io::ErrorKind of the failure.

§

#[non_exhaustive]
S3

Available on crate feature 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 enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§status: u16

The status of the response.

§code: Option<String>

The Code element, or None if the body holds no S3 error.

§message: Option<String>

The Message element, or None if the body holds no S3 error.

§key: Option<String>

The full key of the object, with the prefix of the repository, or None for a request on the bucket, for example a list.

§

#[non_exhaustive]
S3Region

Available on crate feature 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
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§bucket: String

The name of the bucket.

§region: String

The region of the signature.

§bucket_region: String

The region that the server names for the bucket.

Implementations§

Source§

impl Error

Source

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:

Source

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 Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for Error

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Replaced by Error::source.
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

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.

Source§

fn from(msg: ErrorMessage) -> Error

Converts to this type from the input type.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !UnwindSafe for Error

§

impl Forget for Error

§

impl Freeze for Error

§

impl Move for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more