comparison roundup/cgi/exceptions.py @ 8408:e882a5d52ae5

refactor: move RateLimitExceeded to roundup.cgi.exceptions RateLimitExceeded is an HTTP exception that raises code 429. Move it to roundup.cgi.exceptions where all the other exceptions that result in http status codes are located. Also make it inherit from HTTPException since it is one. Also add docstrings for all HTTP exceptions and order HTTPExceptions by status code. BREAKING CHANGE: if somebody is importing RateLimitExceeded they will need to change their import. I consider it unlikely anybody is using RateLimitExceeded. Detectors and extensions are unlikely to raise RateLimitExceeded. So I am leaving it out of the upgrading doc. Just doc in change log.
author John Rouillard <rouilj@ieee.org>
date Sun, 10 Aug 2025 21:27:06 -0400
parents 700424ba015c
children ef1ea918b07a
comparison
equal deleted inserted replaced
8407:700424ba015c 8408:e882a5d52ae5
22 class Redirect(HTTPException): 22 class Redirect(HTTPException):
23 """HTTP 302 status code""" 23 """HTTP 302 status code"""
24 pass 24 pass
25 25
26 26
27 class NotModified(HTTPException):
28 """HTTP 304 status code"""
29 pass
30
31
27 class NotFound(HTTPException): 32 class NotFound(HTTPException):
28 """HTTP 404 status code unless self.response_code is set to 33 """HTTP 404 status code unless self.response_code is set to
29 400 prior to raising exception. 34 400 prior to raising exception.
30 """ 35 """
31 pass 36 pass
32 37
33 38
34 class NotModified(HTTPException): 39 class PreconditionFailed(HTTPException):
35 """HTTP 304 status code""" 40 """HTTP 412 status code"""
36 pass 41 pass
37 42
38 43
39 class PreconditionFailed(HTTPException): 44 class RateLimitExceeded(HTTPException):
40 """HTTP 412 status code""" 45 """HTTP 429 error code"""
41 pass 46 pass
42 47
43 48
44 class DetectorError(RoundupException): 49 class DetectorError(RoundupException):
45 """Raised when a detector throws an exception. 50 """Raised when a detector throws an exception.

Roundup Issue Tracker: http://roundup-tracker.org/