Skip to content

Conversation

@furszy
Copy link
Member

@furszy furszy commented Sep 12, 2022

Decoupled from #25737 per request.

We are throwing two different error descriptions for the same problematic:

  1. "Expected type {expected], got {type}" --> RPCTypeCheckArgument()
  2. "JSON value of type {type} is not of expected type {expected}" --> UniValue::checkType()

We were throwing two different errors for the same problematic:

* "Expected type {expected], got {type}" --> RPCTypeCheckArgument()
* "JSON value of type {type} is not of expected type {expected}" --> UniValue::checkType()
@furszy furszy changed the title RPC: unify arg type error message rpc: unify arg type error message Sep 12, 2022
@maflcko
Copy link
Member

maflcko commented Sep 12, 2022

review ACK 2870a97

Makes sense to use the same error string that univalue uses internally. The univalue error string was most recently changed in fae5ce8.

@DrahtBot
Copy link
Contributor

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #26039 (rpc: Return RPC_TYPE_ERROR, not RPC_MISC_ERROR on type mismatch (1/2) by MarcoFalke)
  • #25737 (rpc: remove redundant univalue type checks by furszy)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

Copy link
Member

@fanquake fanquake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 2870a97

@fanquake fanquake merged commit e9e943c into bitcoin:master Sep 13, 2022
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Sep 13, 2022
2870a97 RPC: unify arg type error message (furszy)

Pull request description:

  Decoupled from bitcoin#25737 per request.

  We are throwing two different error descriptions for the same problematic:

  1) "Expected type {expected], got {type}" --> `RPCTypeCheckArgument()`
  2) "JSON value of type {type} is not of expected type {expected}" --> `UniValue::checkType()`

ACKs for top commit:
  MarcoFalke:
    review ACK 2870a97
  fanquake:
    ACK 2870a97

Tree-SHA512: 9ac863243b6b7687986c0394611b5cad8b35424ec49d82195d536f2a5e64c60327b25f0dc7336189f86fd71122689c7309da49adfa93805d2e345693fa8efa9b
@furszy furszy deleted the 2022_rpc_unify_error_type branch May 27, 2023 01:47
@bitcoin bitcoin locked and limited conversation to collaborators May 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants