feat: update error notes for wfassoc

This commit is contained in:
2026-06-25 13:42:23 +08:00
parent 1a44240f88
commit 880f90211b
8 changed files with 58 additions and 47 deletions

View File

@@ -63,7 +63,7 @@ impl Manifest {
#[derive(Debug, TeError)]
pub enum ParseSchemaError {
/// Error when operating with schema.
#[error("{0}")]
#[error("failed on parsing manifest file to Schema: {0}")]
Schema(#[from] wfassoc::highlevel::SchemaError)
}

View File

@@ -12,20 +12,21 @@ use toml;
#[derive(Debug, TeError)]
pub enum Error {
/// Error when parsing Manifest TOML file.
#[error("{0}")]
#[error("initialization error: {0}")]
ParseManifest(#[from] manifest::ParseManifestError),
/// Error when parsing Manifest into Schema.
#[error("{0}")]
#[error("initialization error: {0}")]
ParseSchema(#[from] manifest::ParseSchemaError),
/// Error when serializing TOML
#[error("initialization error: {0}")]
SerializeToml(#[from] toml::ser::Error),
/// Error when parsing Schema into Program.
#[error("{0}")]
#[error("wfassoc error: {0}")]
ParseProgram(#[from] wfassoc::highlevel::ParseProgramError),
/// Error when operating Program.
#[error("{0}")]
#[error("wfassoc error: {0}")]
Program(#[from] wfassoc::highlevel::ProgramError),
/// Error when serializing TOML
#[error("{0}")]
SerializeToml(#[from] toml::ser::Error),
/// Find duplicated name when converting extension name to index
#[error("given extension name {0} has been specified more than one time")]
@@ -35,7 +36,7 @@ pub enum Error {
BadExtName(String),
/// Find star (*) extension name with other extension names when converting extension name to index
#[error("wildcard extension name \"*\" is not allowed to be used with other extension names")]
ExclusiveStarExtName(String),
ExclusiveStarExtName,
}
/// Result type used in this module.
@@ -60,7 +61,7 @@ fn stringified_exts_to_indices(
// Check for star (*) with other extensions
let has_star = exts.iter().any(|ext| ext == "*");
if has_star && exts.len() > 1 {
return Err(Error::ExclusiveStarExtName("*".to_string()));
return Err(Error::ExclusiveStarExtName);
}
// If star is present alone, return fixed list from zero to the maximum ext index.