-
-
Notifications
You must be signed in to change notification settings - Fork 42
refactor: modernize error handling and sentry integration #958
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
Conversation
Reviewer's GuideThis refactor modernizes Sentry integration by migrating all Sentry operations to a centralized SentryManager, enriches error configurations with explicit status mapping, and streamlines context building and logging in the error handler while replacing the old Sentry handler Cog with a lean implementation that uses the manager. ER diagram for ErrorHandlerConfig and Sentry status mappingerDiagram
ERROR_HANDLER_CONFIG {
string message_format
string log_level
string sentry_status
boolean send_to_sentry
}
SENTRY_MANAGER {
dict STATUS
}
ERROR_HANDLER_CONFIG ||--o{ SENTRY_MANAGER : "uses STATUS for sentry_status"
Class diagram for Sentry integration refactorclassDiagram
class SentryManager {
+STATUS: dict
+is_initialized: bool
+capture_exception(error, context, level, tags)
+finish_transaction_on_error()
+set_command_context(source)
}
class SentryHandler {
-sentry_manager: SentryManager
+on_command_completion(ctx)
+on_app_command_completion(interaction, command)
}
class ErrorHandlerConfig {
+message_format: str
+log_level: str
+sentry_status: str|None
+send_to_sentry: bool
+detail_extractor: callable|None
}
SentryHandler --> SentryManager : uses
ErrorHandlerConfig --> SentryManager : uses STATUS
Class diagram for updated error handling flowclassDiagram
class ErrorHandler {
+_handle_error(source, error)
+_get_log_context(source, user, error)
+_get_formatted_message(source, error, config)
+_log_and_report_error(root_error, error_type, log_context, config)
+_try_edit_message_with_sentry_id(sent_message, sentry_event_id, log_context)
}
ErrorHandler --> SentryManager : uses
ErrorHandler --> ErrorHandlerConfig : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #958 +/- ##
========================================
+ Coverage 9.26% 9.31% +0.04%
========================================
Files 123 123
Lines 10390 10266 -124
Branches 1276 1252 -24
========================================
- Hits 963 956 -7
+ Misses 9325 9209 -116
+ Partials 102 101 -1
*This pull request uses carry forward flags. Click here to find out more.
☔ View full report in Codecov by Sentry. |
7179364 to
63049dc
Compare
- Replace old sentry.py with new sentry_manager.py - Update error handlers with improved context - Streamline sentry error reporting
63049dc to
b25c120
Compare
Deploying tux with
|
| Latest commit: |
b25c120
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://021d53ce.tux-afh.pages.dev |
| Branch Preview URL: | https://02-error-handling-split.tux-afh.pages.dev |
Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change. If this change fixes any issues please put "Fixes #XX" in the description. Please also ensure to add the appropriate labels to the PR.
Guidelines
My code follows the style guidelines of this project (formatted with Ruff)
I have performed a self-review of my own code
I have commented my code, particularly in hard-to-understand areas
I have made corresponding changes to the documentation if needed
My changes generate no new warnings
I have tested this change
Any dependent changes have been merged and published in downstream modules
I have added all appropriate labels to this PR
I have followed all of these guidelines.
How Has This Been Tested? (if applicable)
Please describe how you tested your code. e.g describe what commands you ran, what arguments, and any config stuff (if applicable)
Screenshots (if applicable)
Please add screenshots to help explain your changes.
Additional Information
Please add any other information that is important to this PR.
Summary by Sourcery
Modernize error handling and Sentry integration by replacing legacy sentry.py logic with a centralized SentryManager, enriching error configurations with status metadata, and simplifying transaction management and context extraction.
Enhancements:
Chores: