caselawclient.errors
1import requests 2 3 4class MarklogicAPIError(requests.HTTPError): 5 status_code = 500 6 default_message = "An error occurred, and we didn't recognise it." 7 8 9class MarklogicBadRequestError(MarklogicAPIError): 10 status_code = 400 11 default_message = "Marklogic did not understand the request that was made." 12 13 14class MarklogicUnauthorizedError(MarklogicAPIError): 15 status_code = 401 16 default_message = "Your credentials are not valid, or you did not provide any by basic authentication" 17 18 19class MarklogicNotPermittedError(MarklogicAPIError): 20 status_code = 403 21 default_message = "Your credentials are valid, but you are not allowed to do that." 22 23 24class MarklogicResourceNotFoundError(MarklogicAPIError): 25 status_code = 404 26 default_message = "No resource with that name could be found." 27 28 29class MarklogicResourceLockedError(MarklogicAPIError): 30 status_code = 409 31 default_message = "The resource is locked by another user, so you cannot change it." 32 33 34class MarklogicResourceUnmanagedError(MarklogicAPIError): 35 """Note: this exception may be raised if a document doesn't exist, 36 since all documents should be managed.""" 37 38 status_code = 404 39 default_message = ( 40 "The resource isn't managed. It probably doesn't exist, and if it does, that's a problem. Please report it." 41 ) 42 43 44class MarklogicResourceNotCheckedOutError(MarklogicAPIError): 45 status_code = 409 46 default_message = "The resource is not checked out by anyone, but that request needed a checkout first." 47 48 49class MarklogicCheckoutConflictError(MarklogicAPIError): 50 status_code = 409 51 default_message = "The resource is checked out by another user." 52 53 54class MarklogicValidationFailedError(MarklogicAPIError): 55 status_code = 422 56 default_message = "The XML document did not validate according to the schema." 57 58 59class MarklogicCommunicationError(MarklogicAPIError): 60 status_code = 500 61 default_message = "Something unexpected happened when communicating with the Marklogic server." 62 63 64class GatewayTimeoutError(MarklogicAPIError): 65 "This will not contain XML, because it is a failure to connect to the Marklogic server." 66 67 status_code = 504 68 default_message = "The gateway to MarkLogic timed out." 69 70 71class InvalidContentHashError(MarklogicAPIError): 72 # This error does not come from Marklogic, but is an error raised by this API... 73 status_code = 422 74 default_message = "The content hash in the document did not match the hash of the content" 75 76 77class DocumentNotFoundError(MarklogicAPIError): 78 # This error does not come from Marklogic, but is an error raised by this API... 79 status_code = 404 80 default_message = "The document was not found" 81 82 83class NotSupportedOnVersion(MarklogicAPIError): 84 # This error does not come from Marklogic, but is an error raised by this API... 85 status_code = 400 86 default_message = "An operation was attempted on a version of a document which cannot occur on a version." 87 88 89class OnlySupportedOnVersion(MarklogicAPIError): 90 status_code = 400 91 default_message = "The operation requested cannot be performed on a document that is not a version."
class
MarklogicAPIError(requests.exceptions.HTTPError):
5class MarklogicAPIError(requests.HTTPError): 6 status_code = 500 7 default_message = "An error occurred, and we didn't recognise it."
An HTTP error occurred.
10class MarklogicBadRequestError(MarklogicAPIError): 11 status_code = 400 12 default_message = "Marklogic did not understand the request that was made."
An HTTP error occurred.
20class MarklogicNotPermittedError(MarklogicAPIError): 21 status_code = 403 22 default_message = "Your credentials are valid, but you are not allowed to do that."
An HTTP error occurred.
25class MarklogicResourceNotFoundError(MarklogicAPIError): 26 status_code = 404 27 default_message = "No resource with that name could be found."
An HTTP error occurred.
30class MarklogicResourceLockedError(MarklogicAPIError): 31 status_code = 409 32 default_message = "The resource is locked by another user, so you cannot change it."
An HTTP error occurred.
35class MarklogicResourceUnmanagedError(MarklogicAPIError): 36 """Note: this exception may be raised if a document doesn't exist, 37 since all documents should be managed.""" 38 39 status_code = 404 40 default_message = ( 41 "The resource isn't managed. It probably doesn't exist, and if it does, that's a problem. Please report it." 42 )
Note: this exception may be raised if a document doesn't exist, since all documents should be managed.
45class MarklogicResourceNotCheckedOutError(MarklogicAPIError): 46 status_code = 409 47 default_message = "The resource is not checked out by anyone, but that request needed a checkout first."
An HTTP error occurred.
50class MarklogicCheckoutConflictError(MarklogicAPIError): 51 status_code = 409 52 default_message = "The resource is checked out by another user."
An HTTP error occurred.
55class MarklogicValidationFailedError(MarklogicAPIError): 56 status_code = 422 57 default_message = "The XML document did not validate according to the schema."
An HTTP error occurred.
60class MarklogicCommunicationError(MarklogicAPIError): 61 status_code = 500 62 default_message = "Something unexpected happened when communicating with the Marklogic server."
An HTTP error occurred.
65class GatewayTimeoutError(MarklogicAPIError): 66 "This will not contain XML, because it is a failure to connect to the Marklogic server." 67 68 status_code = 504 69 default_message = "The gateway to MarkLogic timed out."
This will not contain XML, because it is a failure to connect to the Marklogic server.
72class InvalidContentHashError(MarklogicAPIError): 73 # This error does not come from Marklogic, but is an error raised by this API... 74 status_code = 422 75 default_message = "The content hash in the document did not match the hash of the content"
An HTTP error occurred.
78class DocumentNotFoundError(MarklogicAPIError): 79 # This error does not come from Marklogic, but is an error raised by this API... 80 status_code = 404 81 default_message = "The document was not found"
An HTTP error occurred.
84class NotSupportedOnVersion(MarklogicAPIError): 85 # This error does not come from Marklogic, but is an error raised by this API... 86 status_code = 400 87 default_message = "An operation was attempted on a version of a document which cannot occur on a version."
An HTTP error occurred.
90class OnlySupportedOnVersion(MarklogicAPIError): 91 status_code = 400 92 default_message = "The operation requested cannot be performed on a document that is not a version."
An HTTP error occurred.