Skip to content

Commit

Permalink
Add generic :custom_error on HTTP/2 frames (#445)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiserdan committed Jul 4, 2024
1 parent 4f0c534 commit 380212f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/mint/http2/frame.ex
Original file line number Diff line number Diff line change
Expand Up @@ -472,4 +472,7 @@ defmodule Mint.HTTP2.Frame do
defp humanize_error_code(unquote(code)), do: unquote(human_code)
defp dehumanize_error_code(unquote(human_code)), do: unquote(code)
end

defp humanize_error_code(code), do: {:custom_error, code}
defp dehumanize_error_code({:custom_error, code}), do: code
end
5 changes: 4 additions & 1 deletion test/mint/http2/frame_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,10 @@ defmodule Mint.HTTP2.FrameTest do
:connect_error,
:enhance_your_calm,
:inadequate_security,
:http_1_1_required
:http_1_1_required,
{:custom_error, 0x11},
{:custom_error, 0xFF},
{:custom_error, 70007}
])
end
end

0 comments on commit 380212f

Please sign in to comment.