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

Strip useless linebreak in the payload of send:exception events #7407

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Strip useless linebreak in the payload of send:exception events
`traceback.format_exception` adds a `\n` to each element of the resulting
list, so the message will always have a pointless `\n` at the end. Removing
it makes CSV reports that include the message easier to parse visually,
because there's no longer a linebreak in the middle of each line.
  • Loading branch information
SpecLad committed Jan 29, 2024
commit 3e4ee540e14d571d017bc0fd696998386b1e635a
5 changes: 5 additions & 0 deletions changelog.d/20240129_190242_roman_HEAD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Changed

- The "message" field of the payload of send:exception events
no longer includes a trailing linebreak
(<https://github.com/opencv/cvat/pull/7407>)
4 changes: 2 additions & 2 deletions cvat/apps/events/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def handle_rq_exception(rq_job, exc_type, exc_value, tb):
tb_strings = traceback.format_exception(exc_type, exc_value, tb)

payload = {
"message": tb_strings[-1],
"message": tb_strings[-1].rstrip("\n"),
"stack": ''.join(tb_strings),
}

Expand Down Expand Up @@ -563,7 +563,7 @@ def handle_viewset_exception(exc, context):
"content_type": request.content_type,
"method": request.method,
},
"message": tb_strings[-1],
"message": tb_strings[-1].rstrip("\n"),
"stack": ''.join(tb_strings),
"status_code": status_code,
}
Expand Down
Loading