Skip to content

Commit

Permalink
dump content of response if exists
Browse files Browse the repository at this point in the history
  • Loading branch information
hmpf committed Jan 24, 2025
1 parent 120b1ef commit 2fc059e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/argus/htmx/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ def process_response(self, request: HtmxHttpRequest, response: HttpResponse) ->
has_error_message = any("error" in message.tags for message in storage)
storage.used = False
if not has_error_message:
error_msg = f"{response.status_code} {response.reason_phrase}"
error_msg = str(getattr(response, "content", b""))
if not error_msg:
error_msg = f"{response.status_code} {response.reason_phrase}"
messages.error(
request, f"An error occured while processing your request, please try again: {error_msg}"
)
Expand Down

0 comments on commit 2fc059e

Please sign in to comment.