adhocracy_core.rest.exceptions module¶
HTTP Exception (500, 310, 404,..) processing.
-
exception
JSONHTTPClientError(error_entries: [<class 'adhocracy_core.interfaces.ErrorEntry'>], request: pyramid.request.Request=None, code: int=400, title: str='Bad Request')[source]¶ Bases:
pyramid.httpexceptions.HTTPClientErrorHTTPException with json body to describe the exception.
Parameters: - errors – error entries to generate the error description.
- request – Request causing the error to log debug information.
- code – http status code
- title – http status title
The body contains a dictionary with the following data structure:
- status: ‘error’
- errors: [error_entry]
-
handle_error_40x_exception(error, request)[source]¶ Return JSON error for generic HTTPClientErrors.
If error is
JSONHTTPClientErrorit is return without modifications.
-
handle_error_400_colander_invalid(invalid, request)[source]¶ Return JSON error for colander.Invalid errors.
-
handle_error_400_bad_request(error, request)[source]¶ Return 400 JSON error with filtered error messages.
-
get_json_body(request: pyramid.request.Request) → object[source]¶ Return json body of request, defaults to empty dict.
-
handle_error_400_auto_update_no_fork_allowed(error, request)[source]¶ Return 400 JSON error for the internal “No Fork allowed” error.
Assuming there was a post request with wrong values for ‘root_versions’.