Skip to content

fix(interpreter): implement Unwrap on query error types#168

Merged
Azorlogh merged 1 commit into
mainfrom
fix/query-error-unwrap
Jul 8, 2026
Merged

fix(interpreter): implement Unwrap on query error types#168
Azorlogh merged 1 commit into
mainfrom
fix/query-error-unwrap

Conversation

@Azorlogh

@Azorlogh Azorlogh commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What

Implement Unwrap() on QueryBalanceError and QueryMetadataError.

Why

Both types wrap a store error (the error returned by Store.GetBalances / Store.GetAccountsMetadata) but only implemented Error(), which stringifies the wrapped error. Without Unwrap() the error chain is severed: errors.Is / errors.As cannot 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 via errors.Is/errors.As.

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.
@NumaryBot

Copy link
Copy Markdown
Contributor

✅ Approve — automated review

The 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.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 16a97ee9-7d5f-4186-83d5-cf5043964bc9

📥 Commits

Reviewing files that changed from the base of the PR and between 1643d54 and a12fd57.

📒 Files selected for processing (1)
  • internal/interpreter/interpreter_error.go

Walkthrough

This 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.

Changes

Error Unwrap Methods

Layer / File(s) Summary
Add Unwrap support to query errors
internal/interpreter/interpreter_error.go
QueryBalanceError and QueryMetadataError each gain an Unwrap() error method returning their WrappedError field, enabling errors.Is/errors.As compatibility.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Poem

Two little errors, wrapped up tight,
Now unwrap easy, day or night.
With a hop and a twitch of my nose,
errors.Is now surely knows! 🐇
Bugs beware, the chain unrolls~

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding Unwrap to the interpreter query error types.
Description check ✅ Passed The description accurately explains the Unwrap addition and its impact on error chaining.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/query-error-unwrap

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.96%. Comparing base (1643d54) to head (a12fd57).

Files with missing lines Patch % Lines
internal/interpreter/interpreter_error.go 0.00% 4 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Azorlogh Azorlogh requested a review from a team July 7, 2026 12:37
@ascandone

Copy link
Copy Markdown
Contributor

@Azorlogh thanks!

@Azorlogh Azorlogh merged commit 77cd8ca into main Jul 8, 2026
6 of 8 checks passed
@Azorlogh Azorlogh deleted the fix/query-error-unwrap branch July 8, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants