mando-lib-macro
OUTDATED (2026-07-10) — this crate does not exist on
developVerified: no
mando-lib-macroin theorigin/developtree andgit grep ErrorCode origin/developis empty. TheErrorCodederive exists only in.worktrees/experiments (poc-error-extractor, BE-2023, and insidemando-flow-step-derivein the BE-1595/BE-3482 worktrees). Ondevelop,error.kind/error.codefields are extracted at runtime by themando_core::error!macro from the error’s Debug repr — no derive. The parentpoc/CLAUDE.mdis stale on this too. Do not confuse withmando-flow-step-deriveondevelop, which derivesParamEnum/ParamMeta(flow-step params), notErrorCode. See Mando AGENTS.md Master Guide. Content below kept as a record of the worktree experiments’ design.
Procedural macro crate for the Mando workspace. Provides the #[derive(ErrorCode)] macro used throughout mando-lib.
#[derive(ErrorCode)]
Auto-generates error code tracking for enum variants. Maps each variant to a static string identifier for structured error reporting and observability.
Usage
use mando_lib_macro::ErrorCode;
use thiserror::Error;
#[derive(Error, ErrorCode)]
pub enum DataPointError {
#[error("path fragment '{0}' must contain...")]
InvalidPathFragmentFormat(usize, String),
#[error("data point not found: {0}")]
NotFound(String),
}Generated Output
impl ErrorCode for DataPointError {
fn error_code(&self) -> &'static str {
match self {
Self::InvalidPathFragmentFormat(..) =>
"crate::datapoint::DataPointError::InvalidPathFragmentFormat",
Self::NotFound(..) =>
"crate::datapoint::DataPointError::NotFound",
}
}
}Each variant maps to a fully qualified path string, making error codes stable, unique, and grep-friendly across the codebase.
Dependencies
| Crate | Purpose |
|---|---|
syn | Rust syntax parsing |
quote | Code generation |
proc-macro2 | Token stream manipulation |
proc-macro-crate 3.4.0 | Resolves renamed crate imports |
Notes
proc-macro-cratehandles cases wheremando-libis imported under a different name- The macro is a proc-macro crate (
libtype withproc-macro = true) - Used alongside
thiserrorforDisplay+std::error::Errorimplementations