fix(interpreter): implement Unwrap on query error types#168
Conversation
QueryBalanceError and QueryMetadataError wrap a store error but did not implement Unwrap, so errors.Is / errors.As could not reach the wrapped cause — callers only saw the message. Implement Unwrap on both so the wrapped store error stays reachable through the chain.
✅ Approve — automated reviewThe added Unwrap methods correctly expose the stored wrapped errors without changing existing Error behavior. I found no regressions or blocking issues in the diff. No findings. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis change adds Unwrap() error methods to QueryBalanceError and QueryMetadataError types in the interpreter package, enabling standard Go error unwrapping via their WrappedError fields, with no other behavior modified. ChangesError Unwrap Methods
Estimated code review effort: 1 (Trivial) | ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #168 +/- ##
==========================================
- Coverage 70.04% 69.96% -0.08%
==========================================
Files 55 55
Lines 5024 5028 +4
==========================================
- Hits 3519 3518 -1
- Misses 1313 1317 +4
- Partials 192 193 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@Azorlogh thanks! |
What
Implement
Unwrap()onQueryBalanceErrorandQueryMetadataError.Why
Both types wrap a store error (the error returned by
Store.GetBalances/Store.GetAccountsMetadata) but only implementedError(), which stringifies the wrapped error. WithoutUnwrap()the error chain is severed:errors.Is/errors.Ascannot reach the wrapped cause, so a caller can only read the message, not classify the underlying error.Implementing
Unwrap()is the standard contract for a wrapping error and lets callers recover the store error's concrete type/sentinel through the chain.Impact
Behaviour-preserving for existing callers (
Error()unchanged). Callers that want to classify a store failure surfaced through a balance/metadata query can now do so viaerrors.Is/errors.As.