#[non_exhaustive]pub enum Error {
UnknownAgent {
name: String,
valid: Vec<String>,
},
UnknownScope {
value: String,
},
UnknownSkill {
name: String,
embedded: Vec<String>,
},
NoAgentSelected,
NeedsForce(ForceRequired),
ProjectIsHome {
dir: PathBuf,
},
ProjectEscapes {
dir: PathBuf,
real: PathBuf,
},
Usage(String),
Skills(String),
Cancelled,
Help,
Io {
context: String,
source: Error,
},
}Expand description
Everything this library refuses to do, and why.
Each variant a user’s own input can cause is one a front end can match on, so a mistyped flag is told apart from a disk that is full:
let (results, outcome) = skills.install(&options);
print!("{}", skill_embed::render_results(&results, options.dry_run));
if let Err(skill_embed::Error::NeedsForce(_)) = outcome {
// tell the user to re-run with --force
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UnknownAgent
--agent named no agent this tool offers.
Fields
UnknownScope
--scope was neither project nor user.
UnknownSkill
A named skill is not embedded.
NoAgentSelected
The --agent values resolved to nothing at all.
NeedsForce(ForceRequired)
A destination held something this tool did not write, or something edited after it did.
Install leaves those skills alone and writes the rest, so the results it returns alongside this are still worth reporting.
ProjectIsHome
Project scope resolved to the home directory.
The user scope directories live there. A project installation written
into them would put one project’s skills in front of every other
project, and --scope user already writes there on purpose.
ProjectEscapes
A project scope destination is outside the project root.
The path a project install writes to comes from the project, so a link
committed at .claude/skills, or at any directory above it, aims the
write and a later forced removal wherever it points. Cloning a
repository and running the tool once is the whole of it. User scope and
--dir are the user naming a place, and are not bounded this way.
Usage(String)
The command line could not be read.
Skills(String)
The embedded skills could not be read as skills. It is a build-time mistake rather than a runtime condition.
Cancelled
The run was cancelled through InstallOptions::cancel.
Help
Help was asked for and printed. It is not a failure.
Io
Something the file system refused.
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()