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

Log a warning on DocumentNotFound #2259

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

mtaylorgds
Copy link
Contributor

@mtaylorgds mtaylorgds commented Jul 24, 2024

Log a warning when a Mongoid::Errors::DocumentNotFound error is raised in a controller. These errors were being silently swallowed by the application.

The error occurs when an attempt is made to load a document that doesn't exist, which can happen when the overnight DB replication from prod->integration fails. It will also happen if the edition ID is manipulated in the URL (e.g. in URLs of the form
/editions/[edition-id]), so it's not necessarily an error when it happens.

Example log

image

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

@mtaylorgds mtaylorgds marked this pull request as draft July 24, 2024 15:10
Log a warning when a `Mongoid::Errors::DocumentNotFound` error is raised
 in a controller. These errors were being silently swallowed by the
 application.

The error occurs when an attempt is made to load a document that doesn't
 exist, which can happen when the overnight DB replication from
 prod->integration fails. It will also happen if the edition ID is
 manipulated in the URL (e.g. in URLs of the form
 `/editions/[edition-id]`), so it's not _necessarily_ an error when it
 happens.
@mtaylorgds mtaylorgds force-pushed the 359/log-warning-when-document-not-found branch from 15337f3 to 39c461c Compare July 25, 2024 12:12
@mtaylorgds mtaylorgds marked this pull request as ready for review July 25, 2024 12:33
Copy link
Contributor

@baisa baisa left a comment

Choose a reason for hiding this comment

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

Super useful, thank you @mtaylorgds 👌

@mtaylorgds mtaylorgds merged commit 001eb02 into main Jul 25, 2024
12 checks passed
@mtaylorgds mtaylorgds deleted the 359/log-warning-when-document-not-found branch July 25, 2024 13:02
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.

2 participants