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

[ELIX-41] Add details field to gRPC error struct #13

Draft
wants to merge 1 commit into
base: brex-head
Choose a base branch
from

Conversation

rishab-brex
Copy link

@rishab-brex rishab-brex commented Oct 19, 2021

Adds a details field of type [any()] to the error struct and updates the
transport layer to properly encode + decode them.

Jira ticket: https://brexhq.atlassian.net/browse/ELIX-41

Motivation: https://docs.google.com/document/d/1XgMF_YjbHQn8I4Aib9qOO69A0Y6k3CjLpswjLvErvh0/edit

@rishab-brex rishab-brex changed the title Add details field to gRPC error struct [ELIX-41] Add details field to gRPC error struct Oct 19, 2021
Adds a details field of type [any()] to the error struct and updates the
transport layer to properly encode + decode them.
%{
"grpc-status" => Integer.to_string(status),
"grpc-message" => message
"grpc-message" => message,
"grpc-details" => details |> Enum.join(",")
Copy link
Author

@rishab-brex rishab-brex Oct 19, 2021

Choose a reason for hiding this comment

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

we need to be able to encode the details field (a list of of type [any()]) to a string and back without knowing the types. is there a way to do this without knowing the type of struct/string/integer/etc. to decode to?

assert %GRPC.RPCError{
status: GRPC.Status.unauthenticated(),
message: "string_errors",
details: ["hello", "world"]
Copy link
Author

Choose a reason for hiding this comment

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

this test works

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.

1 participant