swh.web.common.exc module

exception swh.web.common.exc.BadInputExc[source]

Bases: ValueError

Wrong request to the api.

Example: Asking a content with the wrong identifier format.

exception swh.web.common.exc.NotFoundExc[source]

Bases: Exception

Good request to the api but no result were found.

Example: Asking a content with the right identifier format but that content does not exist.

exception swh.web.common.exc.ForbiddenExc[source]

Bases: Exception

Good request to the api, forbidden result to return due to enforce

policy.

Example: Asking for a raw content which exists but whose mimetype is not text.

exception swh.web.common.exc.LargePayloadExc[source]

Bases: Exception

The input size is too large.

Example: Asking to resolve 10000 persistent identifier when the limit is 1000.

swh.web.common.exc.swh_handle400(request, exception=None)[source]

Custom Django HTTP error 400 handler for swh-web.

swh.web.common.exc.swh_handle403(request, exception=None)[source]

Custom Django HTTP error 403 handler for swh-web.

swh.web.common.exc.swh_handle404(request, exception=None)[source]

Custom Django HTTP error 404 handler for swh-web.

swh.web.common.exc.swh_handle500(request)[source]

Custom Django HTTP error 500 handler for swh-web.

swh.web.common.exc.handle_view_exception(request, exc, html_response=True)[source]

Function used to generate an error page when an exception was raised inside a swh-web browse view.