anyhow 1.x provides the anyhow! macro that builds an error value as an expression from a format string, an existing error, or both. masterror only exposes statement-form macros (ensure!, fail!).
Add an expression macro (e.g. error!(AppErrorKind::Validation, "bad input: {value}")) that constructs an AppError inline, supporting:
- format-string interpolation (implicit captures like
format!)
- wrapping an existing
impl Error + Send + Sync value
- optional
AppCode/kind selection with a sensible default
This closes the last ergonomic gap with anyhow for application code.
anyhow 1.x provides the
anyhow!macro that builds an error value as an expression from a format string, an existing error, or both. masterror only exposes statement-form macros (ensure!,fail!).Add an expression macro (e.g.
error!(AppErrorKind::Validation, "bad input: {value}")) that constructs anAppErrorinline, supporting:format!)impl Error + Send + SyncvalueAppCode/kind selection with a sensible defaultThis closes the last ergonomic gap with anyhow for application code.