pub enum KitError {
Show 23 variants
NotInstalled {
name: String,
},
AlreadyInstalled {
name: String,
path: PathBuf,
},
PluginInUse {
name: String,
},
ManifestRead {
path: PathBuf,
source: Error,
},
ManifestParse {
path: PathBuf,
source: Box<Error>,
},
ManifestMissingField {
field: String,
path: PathBuf,
},
LibraryNotFound {
name: String,
tried: String,
},
LibraryLoad {
path: PathBuf,
source: Box<Error>,
},
SymbolMissing {
symbol: String,
},
NullEntry,
LockTimeout {
path: PathBuf,
secs: u64,
},
LockIo {
path: PathBuf,
source: Error,
},
CargoNotFound,
BuildFailed {
code: Option<i32>,
},
BuildArtifactMissing {
stem: String,
dir: String,
},
NoManifest {
dir: PathBuf,
},
NoPackage {
manifest: PathBuf,
},
VersionMismatch {
path: PathBuf,
declared: String,
crate_version: String,
},
Http(String),
Registry(String),
PluginPanicked {
what: String,
},
NoDataDir,
Io(Error),
}Expand description
Errors produced by the kit.
The variants fall into two groups:
- Caller-actionable:
KitError::NotInstalled/KitError::AlreadyInstalled/KitError::PluginInUse/KitError::CargoNotFound— the caller usually takes another route or prompts the user; - Broken environment or data: everything else. These can only be reported.
Variants§
NotInstalled
The plugin to uninstall or update is not installed.
AlreadyInstalled
The plugin to install is already present.
install never overwrites an existing installation; use update to replace it.
PluginInUse
The plugin’s dynamic library is still loaded in this process, so it cannot be deleted.
A .dll that is currently dlopened cannot be removed on Windows; on
Linux/macOS the removal succeeds but the disk space is not reclaimed. Rather
than gamble on it, ask the user to retry from a clean process.
ManifestRead
Reading the manifest file failed.
ManifestParse
The manifest is not valid TOML, or a field has the wrong type.
ManifestMissingField
A required field in the manifest is missing or empty.
LibraryNotFound
No dynamic library matching the naming rules was found in the install dir.
LibraryLoad
dlopen itself failed (corrupt file, wrong architecture, missing dependencies).
SymbolMissing
The library loaded, but it does not export the symbol we look for.
Usually means the wrong thing was installed — e.g. a plain library placed in the plugin directory.
NullEntry
The plugin’s entry function returned a null pointer.
LockTimeout
Timed out waiting for the install lock.
LockIo
An operation on the lock file itself failed.
CargoNotFound
No cargo on PATH, so build-host installation is unavailable.
The caller can use this to tell the user to install a Rust toolchain, or to fall back to prebuilt.
BuildFailed
cargo build failed. stderr has already been passed through to the user
(stdio is inherited).
BuildArtifactMissing
The build succeeded, but there is no cdylib among its artifacts.
NoManifest
No Cargo.toml where one was expected.
NoPackage
cargo metadata did not describe the crate whose manifest was given.
Either the manifest is not part of the reported workspace, or the output could not be matched to it.
VersionMismatch
The plugin manifest’s [plugin] version disagrees with the crate’s own version.
Release assets carry both, and they have to be the same number: the manifest is what a host reads before it downloads anything, and the asset file name is built from the crate version.
Fields
Http(String)
The network request failed. The message carries the URL and status code.
Registry(String)
The registry returned content we could fetch but that is not what we expect.
PluginPanicked
A plugin panicked during a cross-boundary call (caught by catch_unwind on
the host side).
NoDataDir
Neither HOME nor an equivalent system directory is available, so the data dir cannot be determined.
Io(Error)
IO error.
Trait Implementations§
Source§impl Error for KitError
impl Error for KitError
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()