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

Draft - Include more information on AlreadySentError errors #6000

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Adzz
Copy link

@Adzz Adzz commented Dec 5, 2024

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? I have supplied a small example, but the exact wording and contents can be discussed.

I'm happy to roll this out to more places if we agree it's a good idea.

@Adzz Adzz force-pushed the give_more_info_for_not_sent_error branch from ad50d30 to ad557ca Compare December 5, 2024 22:55
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.
@Adzz Adzz force-pushed the give_more_info_for_not_sent_error branch from ad557ca to ad5174a Compare December 5, 2024 22:57
@@ -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)}\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the request path should be in your logs/error handler anyway. Suggestion is to add information like the status code instead and response information.

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

Successfully merging this pull request may close these issues.

2 participants