Repository navigation
feat(core): std::expected error handling - #25
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JfRmXnowFEecvNmG9b9szy
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JfRmXnowFEecvNmG9b9szy
This was referenced Nov 8, 2026
Follows the naming convention of #29 (E prefix for enums). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JfRmXnowFEecvNmG9b9szy
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JfRmXnowFEecvNmG9b9szy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
<aether/core/error.hpp>(header-only):EErrorCode,Error(code, message,std::source_location),Result<T> = std::expected<T, Error>,Status = Result<void>andmakeError. Tests intests/core/error.test.cppcover success, failure, location capture, propagation,Statusand monadic chaining.Design decisions
EErrorCodeis a small enum class (Unknown, InvalidArgument, NotFound, OutOfRange, Unsupported, IoError); extend it as modules need.makeErrorreturnsstd::unexpected<Error>so it converts to anyResult<T>andStatus; its defaultedstd::source_locationargument records the caller's location.AETHER_TRYwould need a GNU statement expression, which is not portable to MSVC-style compilers and is not standard C++; the portable form is a statement-style macro with a hiddenreturn, which is hard to justify for a 3-lineif (!r) return std::unexpected(r.error());.std::expectedmonadic operations (and_then,transform) cover chaining. It can be added later if boilerplate proves heavy.Verification
cmake --preset x64-debug-clang -DBUILD_TESTS=ON, build,ctest --test-dir out/build/x64-debug-clang --output-on-failure: 12/12 passed.x64-debug-clang-shared: 12/12 passed.clang-format --dry-run --Werroron the new files: clean.clang-tidy -p out/build/x64-debug-clang tests/core/error.test.cpp(covers the header): no warnings in user code.Not verified
Closes #8
🤖 Generated with Claude Code
https://claude.ai/code/session_01JfRmXnowFEecvNmG9b9szy