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

Refactor SentryReporter to parse last core output for specific exception types #7727

Merged
merged 2 commits into from
Nov 27, 2023

Conversation

drew2a
Copy link
Contributor

@drew2a drew2a commented Nov 27, 2023

This PR refactors the SentryReporter class to parse the "last core output" only for specific exception types. The send_event function now checks if the exception type is in a predefined set of types that require parsing. If it is, the last core output is split for better representation in the web view and then parsed using the parse_last_core_output function. The resulting core exception is added to the exceptions list, along with some additional modifications to remove unnecessary information.

Additionally, a new test case has been added to ensure that the send_event function correctly calls parse_last_core_output only for specific exception types.

It continues the work done in #7722 and makes the logic of #7066 safer.

…ion types

This commit refactors the `SentryReporter` class to parse the "last core output" only for specific exception types. The `send_event` function now checks if the exception type is in a predefined set of types that require parsing. If it is, the last core output is split for better representation in the web view and then parsed using the `parse_last_core_output` function. The resulting core exception is added to the exceptions list, along with some additional modifications to remove unnecessary information.

Additionally, a new test case has been added to ensure that the `send_event` function correctly calls `parse_last_core_output` only for specific exception types.
@drew2a drew2a force-pushed the feature/sentry_parse_specifi_exceptions branch from 72b714a to 0fb2151 Compare November 27, 2023 15:10
@drew2a drew2a marked this pull request as ready for review November 27, 2023 15:11
@drew2a drew2a requested a review from a team November 27, 2023 15:11
- Refactored the code in `SentryReporter` to handle parsing the last core output.
- Removed unnecessary imports and unused variables.
- Updated the logic to check if it is necessary to parse the last core output.
- Added a new core exception extracted from the last core output, if needed.

Fix test_send_last_core_output in test_sentry_reporter.py

- Removed unnecessary fields from the event values dictionary in `test_send_last_core_output`.
- Updated expected values after refactoring.
@drew2a drew2a merged commit e8b8354 into Tribler:main Nov 27, 2023
17 checks passed
@drew2a drew2a deleted the feature/sentry_parse_specifi_exceptions branch November 27, 2023 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants