Exceptions#
Every exception derives from PloneClientError, and every one is importable from plone_client.
Hierarchy#
Exception |
Parent |
Raised when |
CLI exit code |
|---|---|---|---|
|
Base of all the others. |
1 |
|
|
A profile, a secret, or the URL is missing or invalid. |
3 |
|
|
A read-only client is asked to change the site. |
7 |
|
|
The site cannot be reached. |
8 |
|
|
The site does not answer in time. |
8 |
|
|
An operation of |
That of |
|
|
The site answers with an error not listed below. |
1 |
|
|
|
6 |
|
|
|
4 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
9 |
Attributes of PloneAPIError#
Attribute |
Meaning |
|---|---|
|
HTTP status of the answer. |
|
The error type |
|
The error message |
|
Method of the request. |
|
URL of the request. |
|
The decoded body of the answer. |
Classes#
Exceptions raised by plone-client.
Every exception derives from PloneClientError, so a single
except PloneClientError catches anything the library raises.
Errors answered by the site derive from PloneAPIError and carry the
status code, the error type reported by plone.restapi and the parsed body.
- exception plone_client.exceptions.PloneClientError[source]#
Bases:
ExceptionBase class for every error raised by plone-client.
- exception plone_client.exceptions.PloneConfigurationError[source]#
Bases:
PloneClientErrorThe client, a profile or a secret is missing or invalid.
- exception plone_client.exceptions.PloneReadOnlyError[source]#
Bases:
PloneClientErrorA request that changes the site was refused by a read-only client.
- exception plone_client.exceptions.PloneConnectionError[source]#
Bases:
PloneClientErrorThe site could not be reached.
- exception plone_client.exceptions.PloneTimeoutError[source]#
Bases:
PloneConnectionErrorThe site did not answer in time.
- exception plone_client.exceptions.PloneOperationError(message, result)[source]#
Bases:
PloneClientErrorAn operation of several requests stopped part way.
The error that stopped it is the
__cause__.- Parameters:
message (str) – What failed.
result (Any) – What the operation did before it stopped: the items it created or changed and every request it sent, so a caller can clean up or resume (see
OperationResult).
- Return type:
None
- exception plone_client.exceptions.PloneAPIError(message, *, status_code, error_type='', body=None, method='', url='')[source]#
Bases:
PloneClientErrorThe site answered with an error status.
- Parameters:
message (str) – Error message, taken from the response when possible.
status_code (int) – HTTP status code of the response.
error_type (str) – Error type reported by
plone.restapi(NotFound,BadRequest,Unauthorized…), if any.body (Any) – Parsed JSON body, or the response text.
method (str) – HTTP method of the failed request.
url (str) – URL of the failed request.
- Return type:
None
- exception plone_client.exceptions.PloneBadRequestError(message, *, status_code, error_type='', body=None, method='', url='')[source]#
Bases:
PloneAPIErrorHTTP 400: invalid data, such as a validation error or a duplicated id.
- exception plone_client.exceptions.PloneAuthenticationError(message, *, status_code, error_type='', body=None, method='', url='')[source]#
Bases:
PloneAPIErrorHTTP 401: the credentials are missing, wrong or expired.
- exception plone_client.exceptions.PloneForbiddenError(message, *, status_code, error_type='', body=None, method='', url='')[source]#
Bases:
PloneAPIErrorHTTP 403: the user is not allowed to do this, or the item is locked.
- exception plone_client.exceptions.PloneNotFoundError(message, *, status_code, error_type='', body=None, method='', url='')[source]#
Bases:
PloneAPIErrorHTTP 404: there is nothing at this path.
- exception plone_client.exceptions.PloneConflictError(message, *, status_code, error_type='', body=None, method='', url='')[source]#
Bases:
PloneAPIErrorHTTP 409: the request conflicts with the current state.
- exception plone_client.exceptions.PloneServerError(message, *, status_code, error_type='', body=None, method='', url='')[source]#
Bases:
PloneAPIErrorHTTP 5xx: the site failed to handle the request.
- plone_client.exceptions.error_payload(error)[source]#
JSON description of an error, as the command line and MCP server report it.
- Parameters:
error (PloneClientError) – The error.
- Returns:
{"error": {...}}with the type and message, and the status code and URL for errors answered by the site. For an operation that stopped part way,errordescribes the request that failed andresultwhat the operation had done.- Return type:
- plone_client.exceptions.error_from_response(response)[source]#
Build the exception matching an error response.
- Parameters:
response (Response) – Response with a status code of 400 or more.
- Returns:
An instance of the
PloneAPIErrorsubclass for the status.- Return type: