Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return error message to client upon providing incorrect method parameters #29

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

Eligioo
Copy link
Member

@Eligioo Eligioo commented Dec 13, 2024

Instead of always returning Expected an object for the request parameters statically to the client when incorrect method parameters are provided, return the serde_json error.

Fixes nimiq/core-rs-albatross#3167

Examples:
Input

...
"params": [
	"NQ57 M1NT JRQA FGD2 HX1P FN2G 611P JNAE K7HN",
	"",
	-5
]

Output

...
"error": {
        ...
	"data": "invalid value: integer `-5`, expected u64"
}
...

Input

...
"params": [
	"NQ57 M1NT JRQA FGD2 HX1P FN2G 611P JNAE K7HN",
	"",
],

Output

...
"error": {
        ...
	"data": "Received invalid JSON"
}
...

@Eligioo Eligioo requested a review from jsdanielh December 13, 2024 09:10
@hrxi hrxi merged commit b7fd519 into master Dec 16, 2024
7 checks passed
@jsdanielh jsdanielh deleted the stefan/invalid-params-informative-message branch December 27, 2024 18:04
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.

Make RPC argument errors more informative
3 participants