#[non_exhaustive]pub enum Error {
Show 47 variants
Io(Error),
Core(Error),
ObjectNotFound {
checksum: Checksum,
ty: ObjectType,
},
RefNotFound(String),
RemoteNotFound(String),
RemoteExists(String),
InvalidRefspec(String),
AmbiguousRefspec(String),
NoParentCommit(Checksum),
InvalidFormat(String),
Unsupported(String),
InvalidInput(String),
LockTimeout {
secs: i64,
},
ChecksumMismatch {
expected: Checksum,
actual: Checksum,
},
InsufficientFreeSpace {
shortfall: u64,
},
MutableTree(String),
UnsupportedOverlayFeature(String),
PathNotFound {
path: String,
},
NotADirectory {
path: String,
},
DanglingSymlink {
path: String,
target: String,
},
SymlinkLoop {
path: String,
},
EntryExists {
path: String,
},
Staging(String),
MergeConflict(String),
Checkout(String),
SubpathNotFound(PathBuf),
SubpathNotADirectory(PathBuf),
RequireHardlinks(String),
HardlinkAcrossDevices {
src: u64,
dst: u64,
},
Tar(String),
TarPathname,
ConsumeUnlink {
name: String,
reason: String,
},
ReplaceDirWithFile(String),
ReplaceFileWithDir(String),
TarMissingParent(String),
Signature(String),
Pull(String),
Fetch(String),
HttpStatus {
status: u16,
url: String,
},
RedirectLimit {
url: String,
hops: u32,
},
FetchTooLarge {
limit: u64,
},
ContentEncoded {
url: String,
encoding: String,
},
UploadInterrupted {
url: String,
message: String,
},
InvalidGcRoot {
commit: Checksum,
metadata_key: String,
reason: String,
},
InvalidGcAnchor {
metadata_key: String,
reason: String,
},
Remote(Error),
StaticDeltaNotFound {
from: Option<Checksum>,
to: Checksum,
},
}Expand description
The error of each fallible operation of this crate.
The enum is #[non_exhaustive], so a release can add a variant without a
breaking change. The signing engines and the fetcher have their own error
types, ostrya_sign::Error and fetch::Error.
Each of the two converts into this type.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Io(Error)
An I/O error.
Core(Error)
An error from the format primitives: checksums, key files, and objects.
ObjectNotFound
An object that is not in the object store.
Fields
ty: ObjectTypeThe type of the object that the lookup asked for.
RefNotFound(String)
A refspec that does not resolve to a commit.
RemoteNotFound(String)
A remote with no [remote "<name>"] group in the configuration.
The payload is the name of the remote.
RemoteExists(String)
A remote that already has a [remote "<name>"] group in the
configuration.
The payload is the name of the remote.
InvalidRefspec(String)
A refspec that does not name a path in the refs/ tree.
The causes are:
- an empty name
- an empty,
., or..component - a remote element or a collection element that holds a
/ - an interior NUL
The payload is the refspec as the caller gave it. If the refspec has a
remote or a collection, the payload has the form <remote>:<name> or
<collection-id>:<name>.
AmbiguousRefspec(String)
An abbreviated checksum that is the prefix of two or more commit objects.
Such a checksum names no single commit. The payload is the revision as the caller gave it.
NoParentCommit(Checksum)
A ^ suffix of a revision that asks for the parent of a root commit.
The payload is the checksum of the root commit.
InvalidFormat(String)
Data that does not match its expected format.
Unsupported(String)
An operation or a repository feature that this crate does not support.
A fetch::Error::Unsupported
converts to this variant.
InvalidInput(String)
An argument outside the values that the operation accepts.
An example is a pull depth less than -1.
LockTimeout
A wait for the repository lock or the update lock that passed its limit.
The limit of the wait is the value of [core] lock-timeout-secs. With
the value -1, a wait has no limit and does not give this error. The
message names the repository lock for both locks.
LockKind states the rules of the repository lock,
and UpdateGuard states the rules of the update
lock.
ChecksumMismatch
Data whose computed checksum is not the expected checksum.
The expected checksum is the checksum that the caller of a write gives for the object. In a pull, it is also the advertised checksum of a static-delta superblock.
Fields
InsufficientFreeSpace
A staged object that makes the free space less than the reserve.
The keys min-free-space-percent and min-free-space-size of
[core] set the reserve.
MutableTree(String)
A failure to build or serialize an in-memory tree.
The causes are:
- an invalid entry name
- a file name and a directory name that are the same
- a directory with no dirmeta checksum
- the removal of an absent entry
- a committed subdirectory that is not loaded, with no repository to read it from
UnsupportedOverlayFeature(String)
An overlayfs feature in an upper directory that the merge cannot carry.
An entry with overlay.metacopy or overlay.redirect is not
self-contained. The merge needs an overlay that has the feature off:
metacopy=off and redirect_dir=off.
PathNotFound
A path with a component that is not present.
Fields
path: StringThe path of the absent component.
If a caller has one name and no path, the field holds the bare
entry name. MutableTree::subtree
is such a caller.
NotADirectory
A path component that must be a directory and is a file.
A symlink that resolves to a file also gives this error.
Fields
path: StringThe path of the component that is not a directory.
If a caller has one name and no path, the field holds the bare
entry name. MutableTree::subtree
is such a caller.
DanglingSymlink
A symlink whose target does not resolve.
SymlinkLoop
A path resolution that followed more symlinks than the depth cap.
The cap is 40 symlinks.
EntryExists
An entry at a path where an operation must create a new entry.
Staging(String)
A failure of a staging-tree operation that no other variant names.
The causes are:
- an outstanding file writer that blocks the operation, for example
StagingTree::close - a read of a file at a path that holds a directory
- a hardlink whose source resolves to a directory
- a directory that a concurrent operation removed while the operation held its path
- a path with no final component, or a path that ends in
.. - a path component or a symlink target that is not valid UTF-8
- a rename whose destination is under the moved entry
- a load of a committed directory with no repository handle to read it
MergeConflict(String)
A conflict of a staging-tree merge that the merge options do not permit.
The conflicts are differing files, a file and a directory at one path,
and differing directory metadata. Each one is a conflict only if
allow_overwrite of the
MergeOptions is off.
Checkout(String)
A checkout that cannot proceed.
The causes are:
- a collision under
OverwriteMode::None - a mismatch under
UnionIdentical - a combination of options that a checkout does not accept
- a partial commit
- a whiteout that names no entry
- a destination name that is not valid UTF-8
- a failure to set an extended attribute
SubpathNotFound(PathBuf)
A checkout subpath that names no
entry in the commit tree.
The payload is the value as the caller wrote it.
SubpathNotADirectory(PathBuf)
A checkout subpath that passes
through an entry that is not a directory.
The payload is the value as the caller wrote it.
RequireHardlinks(String)
An entry that a checkout under
require_hardlinks must
copy.
The repository mode and the checkout mode give a copy of the entry. The payload is the name of the entry.
HardlinkAcrossDevices
A hardlink checkout into a directory on another file system.
A checkout under
require_hardlinks cannot
hardlink an entry into a directory on a file system other than the file
system of the repository. The destination root gives this error, and
so does each directory under it. A checkout of a
single file or symlink does no such directory check. It gives this
error if the link of that entry crosses a file system.
The fields hold the device number of each side.
Fields
Tar(String)
A tar import or export that cannot proceed.
The causes are:
- an entry type that a repository cannot store: a device node or a FIFO
- an empty path, or a path with a
..component - a hardlink with no target in the archive
- an xattr name that is not valid UTF-8
- an export subpath that is absent or is not a directory
TarPathname
A tar member whose pathname is not valid UTF-8.
This crate stores pathnames as text, so such a member has no name to import it under.
ConsumeUnlink
A failure to remove an entry of the source under
CONSUME.
The fields hold the name of the entry and the reason of the failure.
Fields
ReplaceDirWithFile(String)
A file from a tree source at a path where an earlier source put a directory.
The payload is the name of the entry.
ReplaceFileWithDir(String)
A directory from a tree source at a path where an earlier source put a file.
The payload is the name of the entry.
TarMissingParent(String)
A tar member whose parent directory is not in the tree.
A tar import gives this error if
TarImportOptions::autocreate_parents
is off. The payload is the name of the first absent ancestor.
Signature(String)
A failure of a signing engine, a key source, or a signature verification.
A signing engine gives this error for these inputs:
- a key of the wrong length
- a public key that is not a valid curve point
- a malformed secret key
- a signature blob that the engine refuses
An ostrya_sign::Error::Signature converts to this variant with the
same message. Each variant of ostrya_sign::Error that the conversion
does not name also converts to this variant.
This crate also builds this variant in these places:
- the verification policy of a pull
- the readers of keyrings and key files
- the GPG key import and the
gpgprogram that it runs - the signature verification of a static delta
Pull(String)
A pull that cannot proceed, or that refuses an object or a commit.
The causes are:
- a remote that is not in the configuration, or that has no
urland nopull-url - a pull of all refs with no configured branches, or in mirror mode with no summary on the remote
- a commit whose
ostree.ref-bindingdoes not name the ref of the pull - a commit that is older than the commit that its ref holds
- a content object whose mode the destination repository cannot store
- a required static delta that is absent, or a delta whose superblock does not produce its target
- a list of static deltas whose superblocks and detached metadata pass the 1 GiB limit of one discovery from a remote
- a subpath that is not an absolute path, or too many subpaths
- a signature verification with no remote to take the keys from
- a client certificate with no client key, or a client key with no client certificate
Fetch(String)
A failure to set up or to carry out a fetch.
The causes include a mirror URL, a header, or a TLS configuration that the fetcher cannot use. They also include a transport failure that outlived the retries.
A fetch::Error::Fetch converts to this
variant with the same message. Each variant of fetch::Error that the
conversion does not name also converts to this variant. A pull also
builds this variant.
HttpStatus
An unsuccessful HTTP status that ended a fetch.
A 404 means that the remote does not hold the object. A pull accepts a 404 as a normal answer for an optional object.
A fetch with mirrors and rounds reports the first definitive failure that it received. If it received no definitive failure, it reports the first retryable failure. If the reported failure is a status, it is this variant.
A fetch::Error::HttpStatus converts
to this variant.
Fields
RedirectLimit
A redirect chain that reached the limit of
max_redirects.
The response at the end of the chain named another URL to follow. Each attempt against one destination counts its own hops, so a repeated round counts again from the destination that the route named.
A fetch::Error::RedirectLimit
converts to this variant.
Fields
FetchTooLarge
A response that declared more bytes than the cap of the caller.
If a body grows past the cap while it streams, the read fails with the
same FileTooLarge kind. The
payload of that I/O error is a message, and it does not downcast to an
error of this crate.
A fetch::Error::FetchTooLarge
converts to this variant.
ContentEncoded
A response that declared a coding in Content-Encoding or
Transfer-Encoding.
The body of such a response holds bytes other than the bytes that the remote stores.
A fetch::Error::ContentEncoded
converts to this variant.
UploadInterrupted
An upload that failed after the fetcher gave its request to the connection.
The server can have received the whole request and acted on it, so the outcome is unknown. The fetcher does not send the request again.
A
fetch::Error::UploadInterrupted
converts to this variant.
Fields
InvalidGcRoot
A GC anchor key whose value a prune cannot read as commit checksums.
gc_root_metadata_keys
and the repository config key [ex-ostrya] gc-root-metadata-keys name
the keys. A value gives this error if its variant type is not
aay, a(say), or a{s(say)}, if an element does not have the shape
of that type, or if a checksum is not 32 bytes.
A prune gives this error for a commit that it reaches. A commit write
refuses the same values with Error::InvalidGcAnchor.
Fields
InvalidGcAnchor
A metadata dict to write that gives a GC anchor key a value that a prune refuses.
Transaction::write_commit,
Transaction::commit,
Repo::write_commit_detached_metadata,
and
Repo::commit_add_composefs_metadata
give this error before they write. The keys are those of the
repository config key [ex-ostrya] gc-root-metadata-keys. The values
and the reasons are those of Error::InvalidGcRoot.
The error names no commit, because write_commit checks the dict
before the commit has a checksum.
Fields
Remote(Error)
A failure of a session of the wire protocol of
ostrya-remote.
The push, the receive side, and the pull over ssh use this protocol.
The causes are:
- an error that the server side sent to the peer with its wire code
- an
Abortfrom the client (Aborted) - an error of the session stream
- on the client side, a push request that the client refuses
(
InvalidInput)
The variant is in every build.
StaticDeltaNotFound
A static delta from from to to that the repository does not hold.
No file resolves at its deltas/<fanout>/<rest> path. The message
names the delta as the ostree command names it.
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<Error> for Error
impl From<Error> for Error
Source§fn from(err: Error) -> Error
fn from(err: Error) -> Error
Maps an error of this crate to the closest std::io::ErrorKind.
The I/O error holds the error as its payload, so its Display and its
source chain stay. An Error::Io comes back unchanged.
A variant gets a specific kind only if the standard set names the
condition. A symlink loop maps to Other,
because ErrorKind::FilesystemLoop is unstable.
Three fetch failures get their own kind:
- An
Error::HttpStatusof 404 maps toNotFound. A remote uses a 404 to state that an object is absent. - A 401 and a 403 map to
PermissionDenied. Each other status maps toOther. - An
Error::FetchTooLargemaps toFileTooLarge.
If a body grows past the cap while it streams, its read fails with the
same FileTooLarge kind. The payload of that error is a message, so
only the converted error downcasts to an error of this crate.
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
Blanket Implementations§
Source§impl<T> AsErrorSource for Twhere
T: Error + 'static,
impl<T> AsErrorSource for Twhere
T: Error + 'static,
Source§fn as_error_source(&self) -> &(dyn Error + 'static)
fn as_error_source(&self) -> &(dyn Error + 'static)
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.