Skip to content

fix(mint): return raw connect errors, not strings - #584

Open
arrangabriel wants to merge 3 commits into
elixir-grpc:masterfrom
arrangabriel:keep-mint-transport-errors
Open

fix(mint): return raw connect errors, not strings#584
arrangabriel wants to merge 3 commits into
elixir-grpc:masterfrom
arrangabriel:keep-mint-transport-errors

Conversation

@arrangabriel

Copy link
Copy Markdown

Return Mint connect failure reason, not a formatted string

Currently, connect/2 inspects whatever ConnectionProcess.start_link/4 returns into a message, so a refused connection results in: {:error, "Error while opening connection: {:error, %Mint.TransportError{reason: :econnrefused}}"}. This is hard for callers to use, e.g. in a case expression. The Gun adapter returns transport errors directly.

Changes

  • connect/2 and its catch :exit clause return the error tuple directly.

@arrangabriel
arrangabriel force-pushed the keep-mint-transport-errors branch from 4c433b1 to b3d9196 Compare September 1, 2026 07:26
@arrangabriel
arrangabriel force-pushed the keep-mint-transport-errors branch from b3d9196 to 932e16b Compare September 1, 2026 07:26
@sleipnir

sleipnir commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

@arrangabriel you can take a look on failures?

Error:      test/grpc/integration/stub_test.exs:96
     Assertion failed, no matching message after 100ms
     The process mailbox is empty.
     code: assert_receive {:initial_call_succeeded, initial_channel, "Hello, first caller"}
     stacktrace:
       test/grpc/integration/stub_test.exs:109: anonymous fn/1 in GRPC.Integration.StubTest."test named Gun connections survive the original caller exiting"/1
       (grpc 1.0.5) test/support/integration_data_case.ex:47: GRPC.Integration.TestCase.run_server/4
       test/grpc/integration/stub_test.exs:97: (test)

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.

2 participants