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

[Code Health] Ensure all message/query handler return gRPC status errors #860

Open
7 tasks
bryanchriswhite opened this issue Oct 7, 2024 · 2 comments · May be fixed by #929
Open
7 tasks

[Code Health] Ensure all message/query handler return gRPC status errors #860

bryanchriswhite opened this issue Oct 7, 2024 · 2 comments · May be fixed by #929
Assignees
Labels
code health Cleans up some code off-chain Off-chain business logic on-chain On-chain business logic

Comments

@bryanchriswhite
Copy link
Contributor

bryanchriswhite commented Oct 7, 2024

Objective

Consistently encapsulate gRPC errors in gRPC status.Error() with appropriate status codes.

Origin Document

Observations made while working on #612.

While we already often wrap errors in custom cosmos-sdk error types, we SHOULD also be wrapping any of those errors which find their way back to a gRPC client in a gRPC status error. See: google.golang.org/grpc/status.

Goals

  • Align with best practices.
  • Improve gRPC client expectations and UX.
  • Improve consistency.

Deliverables

  • A PR for each module which:
    • wraps any non-status errors in all gRPC message/query handlers in an appropriately coded* gRPC status error.
    • updates status codes on existing status errors for which there is a more appropriate code*.

*(see: codes.Code)

Non-goals / Non-deliverables

  • Refactoring (moving / consolidating / renaming / etc.) error variables or types.
  • Refactoring message/query handler logic.

General deliverables

  • Comments: Add/update TODOs and comments alongside the source code so it is easier to follow.
  • Testing: Add new tests (unit and/or E2E) to the test suite.
  • Makefile: Add new targets to the Makefile to make the new functionality easier to use.
  • Documentation: Update architectural or development READMEs; use mermaid diagrams where appropriate.

Creator: @bryanchriswhite

@bryanchriswhite bryanchriswhite added off-chain Off-chain business logic on-chain On-chain business logic code health Cleans up some code labels Oct 7, 2024
@bryanchriswhite bryanchriswhite self-assigned this Oct 7, 2024
@bryanchriswhite bryanchriswhite moved this to 🔖 Ready in Shannon Oct 7, 2024
@Olshansk
Copy link
Member

Olshansk commented Nov 4, 2024

@bryanchriswhite Where are we on this?

@bryanchriswhite
Copy link
Contributor Author

Not started but expected to be low effort. I intended to do this in parallel with a higher effort issue (like #543).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code health Cleans up some code off-chain Off-chain business logic on-chain On-chain business logic
Projects
Status: 🏗 In progress
2 participants