refactor(generator): change CodeGenError name

This commit is contained in:
testuser 2025-02-20 15:13:56 +09:00
parent 122f7a4b3e
commit 34e1528745

View file

@ -28,8 +28,8 @@ use thiserror::Error;
pub enum CodeGenError {
#[error("tokenization(syn) error: {0}")]
SynError(#[from] syn::Error),
#[error("failed to create file: {0}")]
FilePathError(String),
#[error("failed to create file (name duplicated): {0}")]
FilePathDuplicatedError(String),
#[error("parent is required for {module}")]
ParentMissing { module: &'static str },
#[error("Unsupported structure: {}", name)]
@ -373,7 +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::FilePathError(snake_case_name.to_string()));
return Err(CodeGenError::FilePathDuplicatedError(snake_case_name.to_string()));
};
let files = self.elements.into_iter().try_fold(files, |files, e| {
@ -465,7 +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::FilePathError(snake_case_name.to_string()));
return Err(CodeGenError::FilePathDuplicatedError(snake_case_name.to_string()));
}
Ok(files)
}