Skip to content

444#455

Merged
RAprogramm merged 1 commit into
mainfrom
444
Jul 5, 2026
Merged

444#455
RAprogramm merged 1 commit into
mainfrom
444

Conversation

@RAprogramm

Copy link
Copy Markdown
Owner

Closes #444

Adds the app_error! expression macro — ad-hoc AppError construction in one line, closing the ergonomic gap with anyhow!.

Forms

  • app_error!(AppErrorKind::Timeout)AppError::bare(kind), zero allocation
  • app_error!(AppErrorKind::Validation, "bad {value}")AppError::with(kind, ...), full format! grammar with implicit capture, single allocation

Design notes

  • Named app_error! (not error!) to avoid colliding with tracing::error! in user imports
  • Composes with the existing statement macros: fail!(app_error!(...)); fail! grammar intentionally untouched (it accepts arbitrary error expressions, incl. custom error types)
  • Works under no_std (default-features = false) via a hidden alloc::format re-export
  • Documented next to ensure!/fail! in README (regenerated) and macro docs with doctests for every form

Tests

10 new integration tests (bare form, trailing comma, implicit/positional formatting, kind+code correctness, expression position via ok_or_else/map_err, composition with ensure!/fail!); full workspace suite, doctests (175), clippy zero warnings, nightly fmt, readme_sync 36/36 — all green.

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@RAprogramm RAprogramm merged commit 8b08bb9 into main Jul 5, 2026
29 checks passed
@RAprogramm RAprogramm deleted the 444 branch July 5, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add expression macro for ad-hoc error construction (anyhow! parity)

1 participant