Skip to content

API parity with anyhow - bail / ensure, Result alias, downcast, chain#10

Merged
MihaiStreames merged 3 commits into
masterfrom
feat/api-parity
Jun 16, 2026
Merged

API parity with anyhow - bail / ensure, Result alias, downcast, chain#10
MihaiStreames merged 3 commits into
masterfrom
feat/api-parity

Conversation

@MihaiStreames

@MihaiStreames MihaiStreames commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • Result<T> alias for Expected<T> matching Rust's naming
  • ANYHOW_BAIL / ANYHOW_ENSURE macros with BAIL / ENSURE short aliases
  • fail_with(payload, msg, domain) + Failure::downcast<T>() / Failure::is<T>() for typed payloads
  • Failure::chain() and Failure::root_cause() for error inspection
  • test_failure.cpp covering all new Failure API; expanded macro and expected tests
  • 0.1.0 first release

Closes #1 and #2

- add `Result<T>` alias for `Expected<T>` in `anyhow.hpp`
- add `ANYHOW_BAIL` and `ANYHOW_ENSURE` macros; short aliases under `ANYHOW_SHORT_MACROS`
- add `ErrorInfo::payload` (`std::any`) and `fail_with()` for typed payloads
- add `Failure::downcast<T>()` and `Failure::is<T>()` for payload inspection
- add `Failure::chain()` and `Failure::root_cause()` for error inspection
- add `test_failure.cpp` covering downcast, ring buffer, is, chain, root_cause
- expand `test_expected.cpp` with `Result<T>` alias tests
- expand `test_macros.cpp` with bail/ensure tests
- drop redundant `-std=c++20` flag in tests CMake
- update README and docs/vs-rust.md for new API surface
- add CHANGELOG for 0.1.0 first release

closes #1, closes #2
@MihaiStreames MihaiStreames changed the title feat(parity): api parity with anyhow - bail/ensure, Result alias, downcast, chain API parity with anyhow - bail / ensure, Result alias, downcast, chain Jun 16, 2026
@MihaiStreames MihaiStreames self-assigned this Jun 16, 2026
@MihaiStreames MihaiStreames added enhancement New functionality bugfix Incorrect behavior ci Build, CMake, tooling labels Jun 16, 2026
@MihaiStreames MihaiStreames linked an issue Jun 16, 2026 that may be closed by this pull request
@MihaiStreames
MihaiStreames merged commit 8c85f17 into master Jun 16, 2026
2 checks passed
@MihaiStreames
MihaiStreames deleted the feat/api-parity branch July 8, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Incorrect behavior ci Build, CMake, tooling enhancement New functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set up GTest test suite Standard-agnostic API surface parity with anyhow

1 participant