Skip to content

Improve RPC error messages in payjoin-cli#11

Draft
DanGould wants to merge 1 commit intomasterfrom
overnight/issue-1258
Draft

Improve RPC error messages in payjoin-cli#11
DanGould wants to merge 1 commit intomasterfrom
overnight/issue-1258

Conversation

@DanGould
Copy link
Copy Markdown
Owner

@DanGould DanGould commented Mar 2, 2026

Summary

  • Added rpc_context helper that inspects ClientError variants and appends actionable hints
  • For HTTP 500: suggests checking wallet loading and debug.log
  • For connection errors: suggests checking if bitcoind is running
  • Applied to all 10 RPC call sites in wallet.rs

Closes payjoin#1258

Open questions

  • Root cause is in upstream bitcoind-async-client — it calls error_for_status() before reading the response body, discarding JSON-RPC error messages. These hints are a stopgap. Upstream issue should be filed.

Test plan

  • nix fmt -- --ci passes
  • cargo clippy --all-targets --keep-going --all-features -- -D warnings clean
  • codespell clean
  • CI passes on fork

Disclosure: co-authored by Claude

bitcoind-async-client discards JSON-RPC error details from HTTP
500 response bodies, returning only "Obtained failure status(500):
Internal Server Error". This leaves users without actionable
information when e.g. a wallet is not loaded.

Add an rpc_context helper that inspects the ClientError variant
and appends diagnostic hints:
- Status(500, _): suggest checking wallet loading and debug.log
- Connection errors: suggest checking if bitcoind is running

Apply the helper to every RPC call site in wallet.rs so all
bitcoind errors surface useful context.

The upstream library should also be fixed to parse JSON-RPC
errors from non-2xx response bodies.

Closes payjoin#1258
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 2, 2026

Pull Request Test Coverage Report for Build 22568490594

Details

  • 15 of 24 (62.5%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.05%) to 82.434%

Changes Missing Coverage Covered Lines Changed/Added Lines %
payjoin-cli/src/app/wallet.rs 15 24 62.5%
Totals Coverage Status
Change from base Build 22568311370: -0.05%
Covered Lines: 10629
Relevant Lines: 12894

💛 - Coveralls

@DanGould DanGould force-pushed the overnight/issue-1258 branch from 87f5aad to 26b4c5a Compare March 2, 2026 10:41
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 2, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch overnight/issue-1258

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

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.

payjoin-cli RPC errors are obscured

1 participant