harvard-lil / h2o

H2O is a web app for creating and reading open educational resources, primarily in the legal field
https://opencasebook.org
GNU Affero General Public License v3.0
35 stars 30 forks source link

Suppress error for non-existent page #2044

Closed bensteinberg closed 5 months ago

bensteinberg commented 5 months ago

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
codecov-commenter commented 5 months ago

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 :warning:
Additional details and impacted files ```diff @@ 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 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

bensteinberg commented 5 months ago

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.