diff --git a/src/generator.rs b/src/generator.rs index 4ab08eb..67c12c7 100644 --- a/src/generator.rs +++ b/src/generator.rs @@ -28,8 +28,8 @@ use thiserror::Error; pub enum CodeGenError { #[error("tokenization(syn) error: {0}")] SynError(#[from] syn::Error), - #[error("failed to create file (name duplicated): {0}")] - FilePathDuplicatedError(String), + #[error("failed to create file: {0}")] + FilePathError(String), #[error("parent is required for {module}")] ParentMissing { module: &'static str }, #[error("Unsupported structure: {}", name)] @@ -373,9 +373,7 @@ impl CodeGen for Block { log::error!("path {}", out_path.display()); log::error!("old {}", old_out.to_string()); log::error!("new {}", out.to_string()); - return Err(CodeGenError::FilePathDuplicatedError( - snake_case_name.to_string(), - )); + return Err(CodeGenError::FilePathError(snake_case_name.to_string())); }; let files = self.elements.into_iter().try_fold(files, |files, e| { @@ -467,9 +465,7 @@ impl CodeGen for Register { let (out_path, _next_parent_path) = mod_file_path(parent_path, &snake_case_name); log::info!("{:?}", out_path); if files.insert(out_path, out).is_some() { - return Err(CodeGenError::FilePathDuplicatedError( - snake_case_name.to_string(), - )); + return Err(CodeGenError::FilePathError(snake_case_name.to_string())); } Ok(files) }