Skip to content

fix(mint): return errors for non-200 responses - #597

Open
arrangabriel wants to merge 1 commit into
elixir-grpc:masterfrom
arrangabriel:handle-non-200-responses
Open

arrangabriel wants to merge 1 commit into
elixir-grpc:masterfrom
arrangabriel:handle-non-200-responses

Conversation

@arrangabriel

Copy link
Copy Markdown
Contributor

process_response({:status, ...}) now emits an RPCError into the stream when the status is not 200,
instead of only recording it, with the same status and message as GRPC.Client.Adapters.Gun.await/2.

Mint delivers :status ahead of :headers and :data, so the error is the first entry in the response
list: unary calls find it through check_for_error/1 before reaching Keyword.fetch!(responses, :ok), and
streaming calls find it as the first element of the stream. Both now return {:error, %GRPC.RPCError{}} rather
than raising.

The test injects a HEADERS frame carrying :status: 502 and asserts the error arrives ahead of the headers
that follow.

Fixes #596

@arrangabriel

Copy link
Copy Markdown
Contributor Author

That failing test is the same one that has been flaky before @sleipnir

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.

Mint adapter never checks the HTTP status, continuing as if the call succeeded

1 participant