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

Provide a way to send error details with ArmeriaStatusException #4306

Closed
trustin opened this issue Jun 20, 2022 · 0 comments · Fixed by #4341
Closed

Provide a way to send error details with ArmeriaStatusException #4306

trustin opened this issue Jun 20, 2022 · 0 comments · Fixed by #4341

Comments

@trustin
Copy link
Member

trustin commented Jun 20, 2022

When a user implements a gRPC service using AbstractUnaryGrpcService, he or she can throw an ArmeriaStatusException to send an error response. However, the user can't send the error details as defined in status.proto because ArmeriaStatusException doesn't have a details field.

We could:

  • Add byte[] details() to ArmeriaStatusException so that a user can add the serialized details field;
  • Update AbstractUnsafeUnaryGrpcService so it sends the details in an error response; and
  • Update UnaryGrpcClient so it reads the details into ArmeriaStatusException.
jrhee17 added a commit that referenced this issue Apr 2, 2024
)

Motivation:

When a user implements a gRPC service using `AbstractUnaryGrpcService`,
they can throw an `ArmeriaStatusException` to send an error response.
However, the user can't send the error details as defined in
[status.proto](https://github.com/googleapis/googleapis/blob/3474dc892349674efda09d74b3a574765d996188/google/rpc/status.proto#L46)
because `ArmeriaStatusException` doesn't have a details field.

Modifications:

- Add `byte[] details` to `ArmeriaStatusException` so that a user can
add the serialized `details` field;
- Update `AbstractUnsafeUnaryGrpcService` so it sends the `details` in
an error response;
- Update `UnaryGrpcClient` so it reads the details into
`ArmeriaStatusException`.

Result:

- Closes #4306 .
- Users can add custom `details` when throwing an
`ArmeriaStatusException`.

---------

Co-authored-by: jrhee17 <guins_j@guins.org>
Co-authored-by: minux <songmw725@gmail.com>
Co-authored-by: Ikhun Um <ikhun.um@linecorp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant