Refactor error msg

This commit is contained in:
Wataru Otsubo 2025-03-28 03:50:37 +00:00
parent b5d165a3f5
commit cba5b8594b
3 changed files with 8 additions and 7 deletions

View file

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Moved register value mask definitions from reg module to field value impl.
- Updated error messages for #[from] attributed errors.
## [0.3.0] - 2025-03-27

View file

@ -26,7 +26,7 @@ use thiserror::Error;
#[derive(Debug, Error)]
pub enum CodeGenError {
#[error("tokenization(syn) error: {0}")]
#[error("tokenization(syn) error")]
SynError(#[from] syn::Error),
#[error("failed to create file (name duplicated): {0}")]
FilePathDuplicatedError(String),

View file

@ -11,20 +11,20 @@ use crate::{
#[derive(Debug, Error)]
pub enum Error {
#[error("error in getting xml git info: {0}")]
#[error("error in getting xml git info")]
XmlGitInfoError(#[from] XmlGitInfoError),
#[error("io error: {0}")]
#[error("io error")]
IOError(#[from] std::io::Error),
#[error("xml parse error: {0}")]
#[error("xml parse error")]
XmlParseError(#[from] roxmltree::Error),
#[error("dom conversion error: {0}")]
#[error("dom conversion error")]
DomConversionError(#[from] converter::DomConversionError),
#[error("invalid register map:\n{}", ._0.iter().map(|e| e.to_string()).join("\n"))]
RegmapValidationError(Vec<validator::ValidationError>),
#[error("code generation error: {0}")]
#[error("code generation error")]
CodeGenError(#[from] generator::CodeGenError),
#[cfg(feature = "flatmap")]
#[error("csv write error: {0}")]
#[error("csv write error")]
CsvWriteError(#[from] csv::Error),
}