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

Why GRPC.Adapter.Gun.connect/2 returns {:error, String.t()} on error? #159

Closed
bszaf opened this issue Jun 3, 2020 · 1 comment · Fixed by #235
Closed

Why GRPC.Adapter.Gun.connect/2 returns {:error, String.t()} on error? #159

bszaf opened this issue Jun 3, 2020 · 1 comment · Fixed by #235
Labels

Comments

@bszaf
Copy link
Contributor

bszaf commented Jun 3, 2020

I would like to handle some connect errors, that are returned from :gun in specific way.

Is there any reason why the error is converted to string?

{:error, reason} ->
:gun.shutdown(conn_pid)
{:error, "Error when opening connection: #{inspect(reason)}"}
end

Would it be okay to return just {:error, reason} instead of creating String error message?

Otherwise, for compatibility reasons, can another option be added to GRPC.Adapter.Gun.connect/2, that will prevent from converting error into String?

@bszaf bszaf added the question label Jun 3, 2020
@tony612
Copy link
Collaborator

tony612 commented Jun 12, 2020

String is to keep consistent with {:error, "Error when opening connection: protocol #{proto} is not http2"}. Let me change this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants