Skip to content

Adding additional testing for exception handling #2433

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

Merged
merged 2 commits into from
Jun 17, 2025

Conversation

A-Wheeto
Copy link
Contributor

Status

Review progress:

  • Browser tested
  • Front-end review completed
  • Tech review completed

What's changed?

  • Added additional testing for exception handling in the fetch from achiever job

Steps to perform after deploying to production

If the production environment requires any extra work after this PR has been deployed detail it here. This could be running a Rake task, migrating a DB table, or upgrading a Gem. That kind of thing.

@tc-deploybot tc-deploybot temporarily deployed to teachcomputing-pr-2433 June 12, 2025 14:33 Inactive
@A-Wheeto A-Wheeto temporarily deployed to teachcomputing-pr-2433 June 16, 2025 08:34 Inactive
Copy link

Copy link

@matoakley matoakley left a comment

Choose a reason for hiding this comment

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

Nice work @A-Wheeto!

One thing to consider, although not a blocker at all, is that we're tying ourselves in to Sentry as an exception tracker by adding explicit calls to the Sentry gem throughout the job.

If we decided to migrate to another exception tracker in the future (e.g. Honeybadger) then we'd need to find and replace each instance of the call to the Sentry gem.

This problem is often solved by wrapping the calls to the external gem in a local wrapper, e.g. in the this case you could create an ExceptionTracker class with a capture_exception function which then calls Sentry.

With a local abstraction in place, we'd only need to update the ExceptionTracker class if we ever moved to a new provider or if Sentry made a breaking change to their gem's API.

This pattern is typically referred to as Dependency Inversion Principle.

Not necessarily suggesting that we need to implement this now, just a thought for the future.

@A-Wheeto
Copy link
Contributor Author

Thanks @matoakley — really good point, and definitely something worth considering. I'll add a tech debt ticket to the backlog so we can revisit this down the line. Since there’s a chance the website could be handed off to another owner in the future (who might use a different exception tracker), it makes sense to maintain that layer of abstraction.

@A-Wheeto A-Wheeto merged commit cbce768 into main Jun 17, 2025
5 checks passed
@A-Wheeto A-Wheeto deleted the 3062-additional-testing-for-achiever-job branch June 17, 2025 07:28
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.

3 participants