Repository navigation
Step 11a: surface server errors as typed HotRodClientException - #6
Merged
Merged
Conversation
Replace bare std::runtime_error at the operation throw sites with a pure-data HotRodClientException carrying FailurePhase (BeforeSend / AfterSend / ServerError), serverStatus, triedNodes and ownersExhausted. It still derives from std::runtime_error, so existing catches keep working. Parse the server ERROR response (opcode 0x50): its length-prefixed message is now drained in the read loop *before* the pending-request lookup, so an orphan ERROR can no longer desync the connection stream. Add the missing status constants (0x84, 0x87, 0x88) to HeaderCodec.h. Classification uses two orthogonal free helpers instead of a stored flag: isTransient() (futility — the library's call) and outcomeUncertain() (ambiguity — the user's call). COMMAND_TIMEOUT (0x86) is treated as transient and outcome-uncertain; this intentionally diverges from Java, which is safe because ambiguity is carried separately. Step 11b (user-decided retry) remains deferred. Tests: 11 unit + 3 integration added; full suite green (187 unit, 78 integration across 15 suites). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Step 11a of error handling (error surfacing), per the split agreed in
docs/ERROR_HANDLING_DESIGN.md(D1). Step 11b (user-decided retry) is deferred to a follow-up PR.std::runtime_errorat the operation throw sites with a pure-dataHotRodClientExceptioncarryingFailurePhase(BeforeSend / AfterSend / ServerError),serverStatus,triedNodes, andownersExhausted. It still derives fromstd::runtime_error, so existing catches keep working.0x84 REQUEST_PARSING_ERROR,0x87 NODE_SUSPECTED,0x88 ILLEGAL_LIFECYCLE_STATE) toHeaderCodec.h.Classification: two orthogonal axes (no stored
retriableflag)isTransient()— futility ("is a retry worth it?", the library's call).outcomeUncertain()— ambiguity ("might the op have applied?", the user's call).COMMAND_TIMEOUT(0x86) is treated as transient and outcome-uncertain. This intentionally diverges from the Java client (which does not retry it) — safe here because ambiguity is carried separately byoutcomeUncertain(), so the user still decides. Rationale indocs/DECISIONS.md(2026-09-25).Testing
ConnectionUsableAfterServerErrorproves the stream stays in sync: trigger an ERROR on a missing cache, then PUT/GET round-trip on a real cache over the same connection.Out of scope (Step 11b, follow-up)
Defaulted
RetryContexton ops, exclusion-awareselectServerForKey,proxyToNonOwner(default true), thread-safe pool/topology,triedNodesaccumulation.🤖 Generated with Claude Code