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

Add humanize_error_code generic case #437

Closed
kaiserdan opened this issue Jun 13, 2024 · 3 comments · Fixed by #445
Closed

Add humanize_error_code generic case #437

kaiserdan opened this issue Jun 13, 2024 · 3 comments · Fixed by #445

Comments

@kaiserdan
Copy link
Contributor

kaiserdan commented Jun 13, 2024

The humanize_error_code function should have a generic case for error codes that aren't explicitly defined. I sometimes get a 70007 error which then causes an error in the module. Happy to make a PR for this if you like.

(mint 1.6.0) lib/mint/http2.ex:823: Mint.HTTP2.stream/2
(mint 1.6.0) lib/mint/http2.ex:1397: Mint.HTTP2.maybe_concat_and_handle_new_data/2
(mint 1.6.0) Lib/mint/http2. ex:1402: Mint.HTTP2.handle_new_data/3
(mint 1.6.0) lib/mint/http2/frame.ex:99: Mint.HTTP2.Frame.decode_next/2
(mint 1.6.0) lib/mint/http2/frame.ex:237: Mint.HTTP2.Frame.decode_goaway/3
(mint 1.6.0) lib/mint/http2/frame.ex:472: Mint.HTTP2.Frame.humanize_error_code (70007)
** (FunctionClauseError) no function clause matching in Mint.HTTP2.Frame.humanize_error_code/1
@whatyouhide
Copy link
Contributor

@kaiserdan yes would love the help. Does the HTTP/2 spec say what to do in case of unknown errors?

@whatyouhide whatyouhide changed the title Add humanize_error_code generic case Add humanize_error_code generic case Jun 17, 2024
@kaiserdan
Copy link
Contributor Author

@whatyouhide I don't think it's part of the HTTP spec but rather a custom error code thats generated by some webservers or proxies

I solved it locally by adding a generic case for it it as defp humanize_error_code(_), do: :internal_error

Maybe a dedicated error code makes sense like : undefined_error, :unknown_error, :other_error, or :custom_error ?

Let me know what you prefer!

@whatyouhide
Copy link
Contributor

Yeah I would like something like {:custom_error, code}. Thoughts? You're welcome to start on a PR and we can continue the discussion there 🙃

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.

2 participants