#[non_exhaustive]pub enum Error {
Show 28 variants
#[non_exhaustive] Internal {
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
#[non_exhaustive] VerificationRejected {
reason: Option<String>,
},
#[non_exhaustive] ChecksumMismatch {
expected: String,
computed: String,
},
Aborted,
#[non_exhaustive] NotFound {
url: String,
},
#[non_exhaustive] Unauthorized {
status: u16,
url: String,
},
#[non_exhaustive] HttpStatus {
status: u16,
url: String,
},
#[non_exhaustive] NoReleaseFound {
target: Option<String>,
},
#[non_exhaustive] MissingAssetField {
field: String,
},
#[non_exhaustive] InvalidResponse {
source: Box<dyn Error + Send + Sync>,
},
#[non_exhaustive] MissingField {
field: &'static str,
},
NoCurrentVersion,
#[non_exhaustive] InvalidHeader {
source: Box<dyn Error + Send + Sync>,
},
#[non_exhaustive] InvalidAuthToken {
source: Box<dyn Error + Send + Sync>,
},
#[non_exhaustive] InvalidCertificate {
source: Box<dyn Error + Send + Sync>,
},
#[non_exhaustive] InvalidProgressStyle {
source: Box<dyn Error + Send + Sync>,
},
Io(Error),
Zip(Box<dyn Error + Send + Sync>),
Json(Box<dyn Error + Send + Sync>),
Transport(Box<dyn Error + Send + Sync>),
SemVer(Box<dyn Error + Send + Sync>),
ArchiveNotEnabled(String),
CompressionNotEnabled(String),
NoSignatures(ArchiveKind),
Signature(Box<dyn Error + Send + Sync>),
#[non_exhaustive] InvalidAssetName {
name: String,
},
SignatureNonUTF8,
S3Auth(Box<dyn Error + Send + Sync>),
}Expand description
The crate’s single public error type.
§Matching on variants
Error is #[non_exhaustive], so a match must include a wildcard arm. For programmatic
decisions, prefer http_status() and url() over matching on the Display string — the
Display strings are human-facing and may change between minor releases.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
#[non_exhaustive]Internal
An internal invariant of the update pipeline was violated, or an internal task failed.
This signals a bug or an unexpected condition (the extractor source has no file name, a
required path was not found in an archive, an archive path was not valid UTF-8, or a
blocking task failed to join), not a normal failure mode a caller can act on. When the
failure wraps an underlying error (e.g. a tokio JoinError), it is carried as source
and surfaced via std::error::Error::source.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]VerificationRejected
A post-update verification callback (verify_binary) rejected the freshly-extracted binary.
This is a user-controlled rejection: the caller’s verify_binary closure returned Err(..)
(an explicit rejection or a hook IO error), so nothing was installed. reason carries the
hook error’s message when one was returned (else None).
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]ChecksumMismatch
The downloaded artifact’s checksum did not match the expected digest.
expected is the configured digest; computed is the one actually produced from the
downloaded file. Both are hex-encoded lowercase digests.
Fields
This variant is marked as non-exhaustive
Aborted
The user declined the interactive confirmation prompt.
Returned when no_confirm is false (the default) and the user answers anything other
than y / Y / Enter at the “Do you want to continue?” prompt.
#[non_exhaustive]NotFound
A request completed and returned HTTP 404 (resource not found).
url is the request URL that produced the 404.
Fields
This variant is marked as non-exhaustive
A request completed and returned HTTP 401 or 403 (not authorized).
status is the exact HTTP status code (401 or 403). url is the request URL.
Fields
This variant is marked as non-exhaustive
The HTTP status code (401 or 403).
The URL whose response was this status.
#[non_exhaustive]HttpStatus
A request completed and returned a non-2xx status other than 404, 401, or 403.
status is the HTTP status code. url is the request URL.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]NoReleaseFound
No release (or no release asset matching the requested target) was found.
This is the clean negative outcome of a release lookup: the remote listing had no release,
no release matched the requested tag/version, or the resolved release had no asset for
target. target is the requested target triple when the lookup was asset-scoped, else
None.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]MissingAssetField
A release or asset payload from the backend was missing a required field.
field is the name of the absent field (e.g. "tag_name", "browser_download_url"),
or a path to it (e.g. "assets[2].url").
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]InvalidResponse
A backend response could not be parsed.
Wraps the underlying parse error (e.g. an S3 XML reader error or a regex build failure),
surfaced via std::error::Error::source.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]MissingField
A required builder/configuration field was not set.
field names the missing field (e.g. "repo_owner", "bin_name", "region").
Fields
This variant is marked as non-exhaustive
NoCurrentVersion
A bare release listing (ReleaseList::fetch) carries no current version,
so Releases::is_update_available has nothing
to compare its releases against.
Distinct from MissingField: there is no builder field to set. Use
Update::is_update_available on a configured updater (which knows its current version)
instead.
#[non_exhaustive]InvalidHeader
An HTTP header supplied to the builder (request_header / header) was not valid.
Wraps the underlying header-conversion error, surfaced via std::error::Error::source.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]InvalidAuthToken
An auth token could not be encoded as an HTTP Authorization header value.
Wraps the underlying header-conversion error, surfaced via std::error::Error::source.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]InvalidCertificate
A custom TLS root certificate could not be parsed, or the HTTP client that would trust it could not be built.
Produced from build() (via a backend builder’s add_root_certificate) or from a
Download with a root_certificate. Wraps the underlying error, surfaced
via std::error::Error::source.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]InvalidProgressStyle
progress-bar only.A progress-bar template string was not valid (progress-bar).
Wraps the underlying indicatif template error, surfaced via std::error::Error::source.
Fields
This variant is marked as non-exhaustive
Io(Error)
A wrapper over a std::io::Error.
Zip(Box<dyn Error + Send + Sync>)
archive-zip only.A wrapper over a zip archive error (archive-zip).
The concrete error is boxed so that the public API does not change when the underlying
zip implementation evolves. Use std::error::Error::source to inspect the underlying
error.
Json(Box<dyn Error + Send + Sync>)
A wrapper over a serde_json::Error.
The concrete error is boxed so that the public API does not change when the underlying
serde_json implementation evolves. Use std::error::Error::source to inspect the
underlying error.
Transport(Box<dyn Error + Send + Sync>)
The request could not be completed (connection/TLS/timeout/transport failure).
The concrete error is boxed so that the public API does not change when the
reqwest / ureq feature selection changes. Use std::error::Error::source
to inspect the underlying error.
SemVer(Box<dyn Error + Send + Sync>)
A wrapper over a semver::Error.
The concrete error is boxed so that the public API does not change when the underlying
semver implementation evolves. Use std::error::Error::source to inspect the
underlying error.
ArchiveNotEnabled(String)
Used when the archive container feature (archive-tar / archive-zip) for the detected
asset is not enabled. The string is the archive token ("tar" / "zip").
CompressionNotEnabled(String)
The asset is compressed with a codec whose feature is not enabled.
The string is the codec token ("gz"). Enable the matching feature (compression-tar-gz
for gzip) to decode it. Distinct from ArchiveNotEnabled, which
concerns the container format; without this, a gzip asset would install its still-compressed
bytes as the binary.
NoSignatures(ArchiveKind)
signatures only.Used when the repository archive does not contain any signatures to verify with.
Signature(Box<dyn Error + Send + Sync>)
signatures only.A wrapper over a signature-verification error (signatures).
The concrete error is boxed so that the public API surface does not depend on the
signing implementation’s internal error types. Use std::error::Error::source
to inspect the underlying error.
#[non_exhaustive]InvalidAssetName
The release asset name contains path traversal components or separators.
Returned when the server-supplied asset name is empty, is . or .., contains a / or
\ path separator, or is an absolute path. The file would never be created in that case,
so callers do not need to clean up temporary state.
Fields
This variant is marked as non-exhaustive
SignatureNonUTF8
signatures only.Used when the path generated to store the repository archive contains non-UTF8 characters.
S3Auth(Box<dyn Error + Send + Sync>)
s3-auth only.A wrapper over the errors that can occur while signing S3 requests (s3-auth).
The concrete error is boxed so that the public API surface does not depend on the
signing implementation’s internal error types. Use std::error::Error::source
to inspect the underlying error.
Implementations§
Source§impl Error
impl Error
Sourcepub fn http_status(&self) -> Option<u16>
pub fn http_status(&self) -> Option<u16>
The HTTP status code if this error came from a completed non-2xx response
(NotFound => 404, Unauthorized/HttpStatus => their code); None otherwise.
Sourcepub fn url(&self) -> Option<&str>
pub fn url(&self) -> Option<&str>
The URL of the request that failed, for the HTTP error variants
(NotFound/Unauthorized/HttpStatus); None otherwise.
Sourcepub fn no_release_found() -> Error
pub fn no_release_found() -> Error
Construct a NoReleaseFound error: the listing had no release, or
no release matched the requested tag/version. For a lookup that failed to find an asset for
a specific target triple, use
no_release_found_for_target.
Sourcepub fn no_release_found_for_target(target: impl Into<String>) -> Error
pub fn no_release_found_for_target(target: impl Into<String>) -> Error
Construct a NoReleaseFound error for an asset-scoped lookup:
a release was resolved but had no asset matching target.
Sourcepub fn missing_asset_field(field: impl Into<String>) -> Error
pub fn missing_asset_field(field: impl Into<String>) -> Error
Construct a MissingAssetField error for a release/asset payload
missing a required field. field names the absent field, or a path to it
(e.g. format!("assets[{i}].url")).
Sourcepub fn checksum_mismatch(
expected: impl Into<String>,
computed: impl Into<String>,
) -> Error
pub fn checksum_mismatch( expected: impl Into<String>, computed: impl Into<String>, ) -> Error
Construct a ChecksumMismatch error from the expected and
computed digests (both hex-encoded lowercase).
Sourcepub fn invalid_response(
source: impl Into<Box<dyn Error + Send + Sync>>,
) -> Error
pub fn invalid_response( source: impl Into<Box<dyn Error + Send + Sync>>, ) -> Error
Construct an InvalidResponse error wrapping the underlying parse
error.
Sourcepub fn http_status_error(status: u16, url: impl Into<String>) -> Error
pub fn http_status_error(status: u16, url: impl Into<String>) -> Error
Construct the HTTP status error for a completed non-2xx response: NotFound for 404,
Unauthorized for 401/403, else HttpStatus.
Sourcepub fn verification_rejected(reason: impl Into<String>) -> Error
pub fn verification_rejected(reason: impl Into<String>) -> Error
Construct a VerificationRejected error with the given
reason, for rejecting the extracted binary from a verify_binary hook:
|path: &std::path::Path| {
if check(path) {
Ok(())
} else {
Err(self_update::Error::verification_rejected("new binary failed --version"))
}
}The update pipeline surfaces this error as-is; any other error returned from the hook is
wrapped in a VerificationRejected whose reason is that error’s 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<ComponentRange> for Error
Available on crate feature s3-auth only.
impl From<ComponentRange> for Error
s3-auth only.Source§fn from(e: ComponentRange) -> Self
fn from(e: ComponentRange) -> Self
Source§impl From<InvalidLength> for Error
Available on crate feature s3-auth only.
impl From<InvalidLength> for Error
s3-auth only.Source§fn from(e: InvalidLength) -> Self
fn from(e: InvalidLength) -> Self
Source§impl From<ParseError> for Error
Available on crate feature s3-auth only.
impl From<ParseError> for Error
s3-auth only.Source§fn from(e: ParseError) -> Self
fn from(e: ParseError) -> Self
Source§impl From<SystemTimeError> for Error
Available on crate feature s3-auth only.
impl From<SystemTimeError> for Error
s3-auth only.Source§fn from(e: SystemTimeError) -> Self
fn from(e: SystemTimeError) -> Self
Source§impl From<ZipsignError> for Error
Available on crate feature signatures only.
impl From<ZipsignError> for Error
signatures only.Source§fn from(e: ZipsignError) -> Error
fn from(e: ZipsignError) -> Error
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> 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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more