test: switch order of error code and message check #34366

pull rkrux wants to merge 1 commits into bitcoin:master from rkrux:test-error-debug changing 1 files +3 −3
  1. rkrux commented at 11:56 am on January 21, 2026: contributor

    I feel it’d be easier to debug intermittent test failures if the error message is present in the logs instead of error code. So, switching order of error code and message in the try_rpc function to aid error debugging.

    Should help in debugging #34354 IMO. It’s an intermittent failure on Windows that I can’t reproduce and it’s more difficult to figure out what could have gone wrong only by seeing the error code like below in the CI logs. Given that the functional tests pass, I don’t see a harm in checking for error message first and throwing it in case of a mismatch.

    0AssertionError: Unexpected JSONRPC error code -1
    
  2. test: switch order of error code and message check
    I feel it'd be easier to debug intermittent test failures if the
    error message is present in the logs instead of error code. So,
    switching order of error code and message in the `try_rpc` function
    to aid error debugging.
    0aba464ce7
  3. DrahtBot added the label Tests on Jan 21, 2026
  4. DrahtBot commented at 11:56 am on January 21, 2026: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34366.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK maflcko, polespinasa, fjahr, brunoerg, sedited

    If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

  5. maflcko commented at 12:08 pm on January 21, 2026: member
    lgtm ACK 0aba464ce76522f1be3bb9e471b45438738de492
  6. polespinasa commented at 12:11 pm on January 21, 2026: member
    lgtm ACK 0aba464ce76522f1be3bb9e471b45438738de492
  7. fjahr commented at 4:14 pm on January 21, 2026: contributor

    utACK 0aba464ce76522f1be3bb9e471b45438738de492

    Great idea!

  8. brunoerg approved
  9. brunoerg commented at 4:50 pm on January 21, 2026: contributor
    code review ACK 0aba464ce76522f1be3bb9e471b45438738de492
  10. maflcko commented at 7:54 pm on January 21, 2026: member

    Should help in debugging #34354 IMO. It’s an intermittent failure on Windows that I can’t reproduce and it’s more difficult to figure out what could have gone wrong only by seeing the error code like below in the CI logs.

    I don’t think this help here, because python will already print the full exception while handling another one. It prints in the logs: test_framework.authproxy.JSONRPCException: filesystem error: cannot remove: The process cannot access the file because it is being used by another process [D:\a\_temp\test_runner_₿_🏃_20260120_132914\wallet_assumeutxo_56\node3\regtest\w2\wallet.dat] (-1)

    Though, i still think it makes sense to merge this, because the message is more human friendly than the code, and probably more unique and meaningful. So it probably doesn’t help for the quoted issue, but in other contexts.

  11. sedited approved
  12. sedited commented at 9:58 pm on January 21, 2026: contributor
    ACK 0aba464ce76522f1be3bb9e471b45438738de492
  13. sedited merged this on Jan 21, 2026
  14. sedited closed this on Jan 21, 2026

  15. rkrux commented at 9:10 am on January 22, 2026: contributor

    I don’t think this help here, because python will already print the full exception while handling another one.

    Thanks for pointing out, you are correct. Usually, I have noticed this python exception handling behaviour in my local, but I missed it in the logs of this issue. By default, the last line in the stack trace catches my attention immediately and seeing an error message there will be helpful, might even save some time while debugging. But, yeah, the overall benefit of this PR is mostly cosmetic.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-01-27 06:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me