tests: Add exception error message for JSONRPCException #8810

pull laanwj wants to merge 1 commits into bitcoin:master from laanwj:2016_09_tests_rpc_error changing 1 files +5 −1
  1. laanwj commented at 6:06 PM on September 25, 2016: member

    This improves error reporting if JSONRPCException is not specifically caught and ends up in Python's default backtrace handler.

    Before:

    Traceback (most recent call last):
      File "/.../projects/bitcoin/bitcoin/qa/rpc-tests/test_framework/authproxy.py", line 153, in __call__
        raise JSONRPCException(response['error'])
    test_framework.authproxy.JSONRPCException
    

    After:

    Traceback (most recent call last):
      File "/.../projects/bitcoin/bitcoin/qa/rpc-tests/test_framework/authproxy.py", line 152, in __call__
        raise JSONRPCException(response['error'])
    test_framework.authproxy.JSONRPCException: Unknown named parameter random (-8)
    
  2. tests: Add exception error message for JSONRPCException
    This improves error reporting if `JSONRPCException` is not specifically caught
    and ends up in Python's default backtrace handler.
    
    Before:
    ```
    Traceback (most recent call last):
      File "/.../projects/bitcoin/bitcoin/qa/rpc-tests/test_framework/authproxy.py", line 153, in __call__
        raise JSONRPCException(response['error'])
    test_framework.authproxy.JSONRPCException
    ```
    
    After:
    ```
    Traceback (most recent call last):
      File "/.../projects/bitcoin/bitcoin/qa/rpc-tests/test_framework/authproxy.py", line 152, in __call__
        raise JSONRPCException(response['error'])
    test_framework.authproxy.JSONRPCException: Unknown named parameter random (-8)
    ```
    42f6aed731
  3. laanwj added the label Tests on Sep 25, 2016
  4. MarcoFalke commented at 6:15 PM on September 25, 2016: member

    Could make sense to also cherry-pick to upstream?

  5. laanwj commented at 7:12 PM on September 25, 2016: member

    Yes, would make sense in this case.

  6. laanwj commented at 3:15 PM on September 26, 2016: member

    Looks like upstream already has similar functionality: https://github.com/jgarzik/python-bitcoinrpc/blob/master/bitcoinrpc/authproxy.py#L58 I like this solution better, though, as it also shows the error code.

  7. MarcoFalke commented at 12:22 PM on September 27, 2016: member

    You could cherry-pick upstream (https://github.com/jgarzik/python-bitcoinrpc/pull/48)instead and modify it, so that the error code is passed as well...

    Though, I don't feel strong about this. Unfortunately we already diverged from upstream quite a bit and it turns out for every problem in this file there are two comparable but different solutions. (One for Bitcoin Core and the other for the lib) So we are already "out of sync".

  8. laanwj commented at 1:17 PM on September 27, 2016: member

    Yes I don't care deeply about this either. The projects have different goals, our copy is just for testing the version of Bitcoin Core in the repository while the upstream projects tries to keep as much compatibility as possible.

  9. laanwj merged this on Sep 27, 2016
  10. laanwj closed this on Sep 27, 2016

  11. laanwj referenced this in commit 14e8f9916b on Sep 27, 2016
  12. codablock referenced this in commit 04cf43e6cf on Sep 19, 2017
  13. codablock referenced this in commit acf0295014 on Jan 11, 2018
  14. andvgal referenced this in commit a4c9702e4d on Jan 6, 2019
  15. MarcoFalke locked this on Sep 8, 2021
Contributors
Labels

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-04-13 15:15 UTC

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