36 lines
1.2 KiB
Markdown
36 lines
1.2 KiB
Markdown
[Reviewed]
|
|
# ADR-0010: Explicit recoverable errors
|
|
|
|
## Status
|
|
|
|
Adopted for proof.
|
|
|
|
## Context
|
|
|
|
Mixed boolean/null/exception failure conventions hide invalid state and complicate generated code review.
|
|
|
|
## Decision
|
|
|
|
Recoverable validation/I/O failures return nodiscard std::expected<T, Error>. Optional means legitimate absence. Release checks validate persisted/hostile input; internal invariants may assert. Allocation/library exceptions reach process boundaries, which stop or recover committed state.
|
|
|
|
## Alternatives Considered
|
|
|
|
Exceptions everywhere obscure routine flow; error out-parameters invite partial output; disabling exceptions globally conflicts with libraries.
|
|
|
|
## Benefits
|
|
|
|
Visible contracts, RAII and no nullable success ambiguity.
|
|
|
|
## Costs
|
|
|
|
Propagation and adapter translation boilerplate.
|
|
|
|
## Risks
|
|
|
|
Unchecked results, allocation during mutation, catching/continuing partially advanced ticks.
|
|
|
|
## Consequences
|
|
|
|
Validate before publication; do not promise unproven exception guarantees. Never continue authoritative state after unexpected mid-tick exceptions. Translate library conventions at adapters; test unchanged state after rejection. [expected proposal](https://wg21.link/P0323R12).
|
|
|