Changeset View
Changeset View
Standalone View
Standalone View
swh/web/common/exc.py
Show All 37 Lines | """Good request to the api, forbidden result to return due to enforce | ||||
policy. | policy. | ||||
Example: Asking for a raw content which exists but whose mimetype | Example: Asking for a raw content which exists but whose mimetype | ||||
is not text. | is not text. | ||||
""" | """ | ||||
pass | pass | ||||
anlambert: `LargePayloadExc` seems a more generic name to me. | |||||
class LargePayloadExc(Exception): | |||||
"""The input size is too large. | |||||
Example: Asking to resolve 10000 persistent identifier when the limit | |||||
is 1000. | |||||
""" | |||||
pass | |||||
http_status_code_message = { | http_status_code_message = { | ||||
400: 'Bad Request', | 400: 'Bad Request', | ||||
401: 'Unauthorized', | 401: 'Unauthorized', | ||||
403: 'Access Denied', | 403: 'Access Denied', | ||||
404: 'Resource not found', | 404: 'Resource not found', | ||||
413: 'Payload Too Large', | |||||
500: 'Internal Server Error', | 500: 'Internal Server Error', | ||||
501: 'Not Implemented', | 501: 'Not Implemented', | ||||
502: 'Bad Gateway', | 502: 'Bad Gateway', | ||||
503: 'Service unavailable' | 503: 'Service unavailable' | ||||
} | } | ||||
def _generate_error_page(request, error_code, error_description): | def _generate_error_page(request, error_code, error_description): | ||||
▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines |
LargePayloadExc seems a more generic name to me.