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

Suppress error for non-existent page #2044

Merged
merged 2 commits into from
Mar 20, 2024

Conversation

bensteinberg
Copy link
Contributor

This changes an error to a 404 when the paginator is asked for a page that doesn't exist. Currently, the error looks like

Internal Server Error: /casebooks/11306-abortion-guns-and-climate-change-reading-group-spring-2024/as-printable-html/17/

EmptyPage at /casebooks/11306-abortion-guns-and-climate-change-reading-group-spring-2024/as-printable-html/17/
That page contains no results

@bensteinberg bensteinberg requested a review from a team as a code owner March 20, 2024 15:33
@bensteinberg bensteinberg requested review from matteocargnelutti and rebeccacremona and removed request for a team and matteocargnelutti March 20, 2024 15:33
Copy link
Contributor

@rebeccacremona rebeccacremona left a comment

Choose a reason for hiding this comment

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

Ah! This is so great!

Small suggestion: maybe add an info or debug level logging message, indicating which page of which casebook is empty? I don't see us having time to debug why the page is empty, any time soon, but I think if it is empty, that means some bug happened somewhere, and it might be good to leave breadcrumbs for a potential future dev. But no strong feelings.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 76.90%. Comparing base (e997b79) to head (8ca5bb2).

Files Patch % Lines
web/main/views.py 60.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2044      +/-   ##
===========================================
- Coverage    76.92%   76.90%   -0.02%     
===========================================
  Files           60       60              
  Lines         6995     6998       +3     
===========================================
+ Hits          5381     5382       +1     
- Misses        1614     1616       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bensteinberg
Copy link
Contributor Author

Sure, I'll add logging -- however, my instinct is that this is not from us exposing a bad link, but rather an ill-conceived behavior on the part of a bot; all the hits on the example above are from bingbot.

@bensteinberg bensteinberg merged commit ab56c04 into harvard-lil:develop Mar 20, 2024
2 checks passed
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