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

rpcdaemon: enum values for protocol error codes #2146

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

canepat
Copy link
Member

@canepat canepat commented Jun 26, 2024

This PR adds usage of enumeration values for protocol error codes in JSON RPC API implementations, using the following rules:

  • all existing error code values have been kept unchanged, except for 100 (which is invalid error code)
  • existing error codes hard-coded to 100 have been mapped to kInvalidParams = -32602, kInternalError = -32603 or kServerError = -32000 depending on the context

Extras

  • remove unnecessary co_return at the end of API handlers
  • add some unit tests for API handler dispatching

@canepat canepat added maintenance Some maintenance work (fix, refactor, rename, test...) json rpc api Create/update/delete any JSON-RPC endpoint labels Jun 26, 2024
@canepat canepat requested review from Sixtysixter and lupin012 June 26, 2024 20:04
@canepat canepat marked this pull request as ready for review June 26, 2024 20:58
@canepat canepat merged commit 6e83c0e into master Jun 27, 2024
5 checks passed
@canepat canepat deleted the rpcdaemon_error_codes branch June 27, 2024 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
json rpc api Create/update/delete any JSON-RPC endpoint maintenance Some maintenance work (fix, refactor, rename, test...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants