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

rpcserver: Improve internal error handling. #3182

Merged
merged 1 commit into from
Sep 9, 2023

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Sep 2, 2023

This cleans up the handling of internal errors in the RPC server to be more consistent and use the errors themselves as opposed to their stringized form.

There are far more instances of already having an error to pass along versus the ones that generate new errors at the call site. Accepting the errors directly results in less noise and also makes it harder to misuse.

@davecgh davecgh added this to the 1.9.0 milestone Sep 2, 2023
@davecgh davecgh force-pushed the rpcserver_simplify_internal_err branch from 5b6dea8 to 8defe05 Compare September 2, 2023 05:16
Copy link
Member

@jholdstock jholdstock left a comment

Choose a reason for hiding this comment

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

I haven't pointed them all out individually because it would be quite spammy, but there's a bunch of inconsistency with capitalization - a few error strings which are capitalized, and a few context strings which are not. Many of them were already present and have just been carried forward as-is, but it would be nice to fix them while you are already touching this code.

Overall though this is a nice change.

internal/rpcserver/rpcserver.go Outdated Show resolved Hide resolved
internal/rpcserver/rpcserver.go Outdated Show resolved Hide resolved
@davecgh davecgh force-pushed the rpcserver_simplify_internal_err branch from 8defe05 to ab92754 Compare September 2, 2023 18:28
@davecgh
Copy link
Member Author

davecgh commented Sep 2, 2023

I haven't pointed them all out individually because it would be quite spammy, but there's a bunch of inconsistency with capitalization - a few error strings which are capitalized, and a few context strings which are not. Many of them were already present and have just been carried forward as-is, but it would be nice to fix them while you are already touching this code.

Good observation. They should all be consistent now.

This cleans up the handling of internal errors in the RPC server to be
more consistent and use the errors themselves as opposed to their
stringized form.

There are far more instances of already having an error to pass along
versus the ones that generate new errors at the call site.  Accepting
the errors directly results in less noise and also makes it harder to
misuse.
@davecgh davecgh force-pushed the rpcserver_simplify_internal_err branch from ab92754 to 5204b35 Compare September 9, 2023 01:42
@davecgh davecgh merged commit 5204b35 into decred:master Sep 9, 2023
2 checks passed
@davecgh davecgh deleted the rpcserver_simplify_internal_err branch September 9, 2023 22:16
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.

4 participants