Skip to content

Commit

Permalink
Draft - Include more information on AlreadySentError errors
Browse files Browse the repository at this point in the history
We have an app that is getting a lot of AlreadySentErrors. Likely
somewhere we have missed an `halt()`, but tracking that down is tricky.
I wonder if we could supply some more information in the various places
the error gets raised to help someone debug the issue?

Exact wording and contents can be discussed.
  • Loading branch information
Adzz committed Dec 5, 2024
1 parent 5e62a39 commit ad557ca
Show file tree
Hide file tree
Showing 2 changed files with 249 additions and 140 deletions.
4 changes: 3 additions & 1 deletion lib/phoenix/controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,9 @@ defmodule Phoenix.Controller do
if state in @unsent do
put_private_layout(conn, :phoenix_layout, :replace, layout)
else
raise AlreadySentError
raise AlreadySentError, """
The response was already sent. Request was to `#{conn.request_path}` using #{inspect(layout)}\
"""
end
end

Expand Down
Loading

0 comments on commit ad557ca

Please sign in to comment.