Repository navigation
Add rfl::Error composition methods and opt-in <rfl/error_format.hpp> - #73
Closed
clockblocker wants to merge 2 commits into
Closed
clockblocker wants to merge 2 commits into
clockblocker wants to merge 2 commits into
Conversation
clockblocker
force-pushed
the
error-ergonomics-and-format
branch
from
November 27, 2026 09:13
ddb0460 to
c6bda16
Compare
clockblocker
force-pushed
the
error-ergonomics-and-format
branch
from
November 27, 2026 09:54
c6bda16 to
b9e4768
Compare
Owner
Author
|
Branch is preserved on |
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
Stacked on
#70(error-kind, directly onmain), promotes structured error composition to publicrfl::Errormethods and adds a standalone opt-in<rfl/error_format.hpp>header for diagnostic formatting — without changingError::what()or pulling any extra headers intorfl.hpp.Changes
include/rfl/internal/Error.hpp&include/rfl/parsing/to_single_error_message.hpp:rfl::Error::combine(std::vector<Error>)(delegated to byrfl::parsing::to_single_errorso zero duplication and 100% identicalwhat()output).err.in_field(std::string_view)anderr.at(size_t)/err.at(ErrorDetail::PathSegment)withconst&and&&overloads, preserving every detail'spathandkind.include/rfl/error_format.hpp(standalone opt-in, never included fromrfl.hpp):rfl::format_path(path)— dot/bracket path formatter (users[0].address.zip, quoting special keys).rfl::format_json_pointer(path)— RFC 6901 JSON Pointer (~0/~1escaping).rfl::format_error_tree(err)+ customLeafHookoverload — EffectTreeFormatter-style grouped multi-line diagnostic tree (automatically renders(line L, col C)when#42bSourceLocationis present).tests/json/test_error_format.cpp:Error::combine, lvalue/rvalue.in_field()/.at(),format_path,format_json_pointer,format_error_tree(default +LeafHookswitching onErrorKind), andrfl::json::write(err.details())round-trip JSON serialization.Verification
-std=c++20 -Wall -Wextra -Werror) on<rfl/error_format.hpp>passed.-O3 -Wall -Werror) and ran all error test suites cleanly.