docs: define v1 error and Result contracts - #5
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 33cb2a84ca
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| Error& error() &; | ||
| const Error& error() const &; |
There was a problem hiding this comment.
Reconcile
error() with the existing public contract
When implementing v1 from both API documents, these overloads conflict with docs/api/public-api.md:292, which still specifies Error error() const noexcept. The old contract returns an owning value and promises noexcept, while this document returns references without that guarantee; these signatures cannot coexist as overloads, so callers and implementers receive incompatible ownership and exception contracts. Update the original public API document or explicitly state which contract supersedes it.
Useful? React with 👍 / 👎.
Summary
Defines the v1 error model and
Result<T>contract forcpp_request.Added
docs/api/error-model.mdErrorCodetaxonomydocs/api/result.md[[nodiscard]]has_value()and explicitoperator bool()value()/error()accessor preconditionsstd::variant<T, Error>accepted as initial C++17 candidateResult<void>specializationErrorCode::Nonesentinel requirementKey decisions
Result<T>, not library-specific exceptions.4xx/5xxresponses are validResponsevalues when transport/parsing succeeded.ErrorCodeis the portable public contract; Winsock/POSIX native codes are secondary diagnostics only.Result<T>state; noErrorCode::Noneis required.value()/error()access is a programmer precondition violation rather than an exception-based control-flow path.Result<T>storage remains an implementation detail; C++17std::variantshould be tried before inventing custom discriminated storage.Documentation-only PR; no runtime behavior changes.