Skip to content

Commit

Permalink
Ranch translator: crash_reason should be a two-element tuple (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaharz authored Sep 9, 2024
1 parent 616f667 commit 77a16d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/plug/cowboy/translator.ex
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ defmodule Plug.Cowboy.Translator do
extra,
" terminated\n"
| Exception.format_exit({reason, stack})
], crash_reason: reason, domain: [:cowboy]}
], crash_reason: {reason, stack}, domain: [:cowboy]}
end

defp log_exception?({%{__exception__: true} = exception, _}) do
Expand Down
3 changes: 2 additions & 1 deletion test/plug/cowboy/translator_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ defmodule Plug.Cowboy.TranslatorTest do
refute metadata =~ "conn: %Plug.Conn{"
end

test "metadata in ranch/cowboy lined logs" do
test "metadata in ranch/cowboy linked logs" do
{:ok, _pid} = Plug.Cowboy.http(__MODULE__, [], port: 9005)

metadata =
Expand All @@ -141,6 +141,7 @@ defmodule Plug.Cowboy.TranslatorTest do
end)

assert metadata =~ "crash_reason:"
assert metadata =~ "{GenServer, :call"
assert metadata =~ "domain: [:cowboy]"
end
end

0 comments on commit 77a16d4

Please sign in to comment.