Skip to content

Conversation

@sauravzg
Copy link
Collaborator

Introduces the foundational Status and ServerStatus types for gRPC status handling.

  • Status: Represents a standard gRPC status with a code and message.
  • ServerStatus: A wrapper around Status designed to prevent accidental leakage of sensitive server errors to the client. This type distinction ensures that handlers must explicitly convert to Status, encouraging a conscious decision about what information is exposed.
  • StatusCode: Enum representing standard gRPC status codes.

This implementation provides the necessary types to unblock server-side API development without relying on a heavy tonic::Status. This is not meant to be an intermediate or final Status implementation but serves as a way to implement functional requirements while we design the final Status.

Copy link

@darth-raijin darth-raijin left a comment

Choose a reason for hiding this comment

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

I left one suggestion on the tests about avoiding duplication of the "ok" message by assigning it to a variable and reusing it in the assertions. It should make the test a bit less brittle if the message ever changes.

Introduces the foundational `Status` and `ServerStatus` types for gRPC status handling. * `Status`: Represents a standard gRPC status with a code and message. * `ServerStatus`: A wrapper around `Status` designed to prevent accidental leakage of sensitive server errors to the client. This type distinction ensures that handlers must explicitly convert to `Status`, encouraging a conscious decision about what information is exposed. * `StatusCode`: Enum representing standard gRPC status codes. This implementation provides the necessary types to unblock server-side API development. This is not meant to be an intermediate or final Status implementation but serves as a way to implement functional requirements while we design the final `Status`.
Copy link
Collaborator

@dfawley dfawley left a comment

Choose a reason for hiding this comment

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

This is fine, but I do think we should strongly consider aligning a little more with the internal design for Status, particularly having a StatusError type that can't represent OK, and a Status that is Result<(), StatusError> for now. That might help prevent future misconceptions/etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants