Module couchdb3.exceptions
Expand source code
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import Dict
__all__ = [
"CouchDBError",
"AuthenticationMethodError",
"NameComplianceError",
"ProxySchemeComplianceError",
"UserIDComplianceError",
"BadRequestError",
"UnauthorizedError",
"ForbiddenError",
"NotFoundError",
"MethodNotAllowedError",
"NotAcceptableError",
"ConflictError",
"PreconditionFailedError",
"RequestEntityTooLargeError",
"UnsupportedMediaTypeError",
"RequestRangeNotSatisfiableError",
"ExpectationFailedError",
"InternalServerError",
"STATUS_CODE_ERROR_MAPPING"
]
class CouchDBError(Exception):
"""CouchDB Error"""
class AuthenticationMethodError(CouchDBError):
"""Authentication method is not allowed."""
class NameComplianceError(CouchDBError):
"""Database name does not comply with the CouchDB requirements. For more information please refer to [the official
documentation](https://docs.couchdb.org/en/main/api/database/common.html#put--db)."""
class ProxySchemeComplianceError(CouchDBError):
"""Proxy scheme does not comply with the CouchDB requirements. For more information please refer to [the official
documentation](https://docs.couchdb.org/en/main/api/server/common.html#replicate)"""
class UserIDComplianceError(CouchDBError):
"""User ID does not comply with the CouchDB requirements. For more information please refer to [the official
documentation](https://docs.couchdb.org/en/main/intro/security.html#org-couchdb-user)"""
class BadRequestError(CouchDBError):
"""Bad request structure. The error can indicate an error with the request URL, path or headers. Differences in the
supplied MD5 hash and content also trigger this error, as this may indicate message corruption."""
class UnauthorizedError(CouchDBError):
"""The item requested was not available using the supplied authorization, or authorization was not supplied."""
class ForbiddenError(CouchDBError):
"""The requested item or operation is forbidden."""
class NotFoundError(CouchDBError):
"""The requested content could not be found. The content will include further information, as a JSON object, if
available. The structure will contain two keys, `error` and `reason`. For example:
```
{"error":"not_found","reason":"no_db_file"}
```
"""
class MethodNotAllowedError(CouchDBError):
"""A request was made using an invalid HTTP request type for the URL requested. For example, you have requested a
`PUT` when a `POST` is required. Errors of this type can also triggered by invalid URL strings."""
class NotAcceptableError(CouchDBError):
"""The requested content type is not supported by the server."""
class ConflictError(CouchDBError):
"""Request resulted in an update conflict."""
class PreconditionFailedError(CouchDBError):
"""The request headers from the client and the capabilities of the server do not match."""
class RequestEntityTooLargeError(CouchDBError):
"""A document exceeds the configured `couchdb3/max_document_size` value or the entire request exceeds the
`chttpd/max_http_request_size` value"""
class UnsupportedMediaTypeError(CouchDBError):
"""Content type error."""
class RequestRangeNotSatisfiableError(CouchDBError):
"""The range specified in the request header cannot be satisfied by the server."""
class ExpectationFailedError(CouchDBError):
"""When sending documents in bulk, the bulk load operation failed."""
class InternalServerError(CouchDBError):
"""The request was invalid, either because the supplied JSON was invalid, or invalid information was supplied as
part of the request."""
STATUS_CODE_ERROR_MAPPING: Dict = {
200: None,
201: None,
202: None,
304: None,
400: BadRequestError,
401: UnauthorizedError,
403: ForbiddenError,
404: NotFoundError,
405: MethodNotAllowedError,
406: NotAcceptableError,
409: ConflictError,
412: PreconditionFailedError,
413: RequestEntityTooLargeError,
415: UnsupportedMediaTypeError,
416: RequestRangeNotSatisfiableError,
417: ExpectationFailedError,
500: InternalServerError
}
Classes
class AuthenticationMethodError (*args, **kwargs)
-
Authentication method is not allowed.
Expand source code
class AuthenticationMethodError(CouchDBError): """Authentication method is not allowed."""
Ancestors
- CouchDBError
- builtins.Exception
- builtins.BaseException
class BadRequestError (*args, **kwargs)
-
Bad request structure. The error can indicate an error with the request URL, path or headers. Differences in the supplied MD5 hash and content also trigger this error, as this may indicate message corruption.
Expand source code
class BadRequestError(CouchDBError): """Bad request structure. The error can indicate an error with the request URL, path or headers. Differences in the supplied MD5 hash and content also trigger this error, as this may indicate message corruption."""
Ancestors
- CouchDBError
- builtins.Exception
- builtins.BaseException
class ConflictError (*args, **kwargs)
-
Request resulted in an update conflict.
Expand source code
class ConflictError(CouchDBError): """Request resulted in an update conflict."""
Ancestors
- CouchDBError
- builtins.Exception
- builtins.BaseException
class CouchDBError (*args, **kwargs)
-
CouchDB Error
Expand source code
class CouchDBError(Exception): """CouchDB Error"""
Ancestors
- builtins.Exception
- builtins.BaseException
Subclasses
- AuthenticationMethodError
- BadRequestError
- ConflictError
- ExpectationFailedError
- ForbiddenError
- InternalServerError
- MethodNotAllowedError
- NameComplianceError
- NotAcceptableError
- NotFoundError
- PreconditionFailedError
- ProxySchemeComplianceError
- RequestEntityTooLargeError
- RequestRangeNotSatisfiableError
- UnauthorizedError
- UnsupportedMediaTypeError
- UserIDComplianceError
class ExpectationFailedError (*args, **kwargs)
-
When sending documents in bulk, the bulk load operation failed.
Expand source code
class ExpectationFailedError(CouchDBError): """When sending documents in bulk, the bulk load operation failed."""
Ancestors
- CouchDBError
- builtins.Exception
- builtins.BaseException
class ForbiddenError (*args, **kwargs)
-
The requested item or operation is forbidden.
Expand source code
class ForbiddenError(CouchDBError): """The requested item or operation is forbidden."""
Ancestors
- CouchDBError
- builtins.Exception
- builtins.BaseException
class InternalServerError (*args, **kwargs)
-
The request was invalid, either because the supplied JSON was invalid, or invalid information was supplied as part of the request.
Expand source code
class InternalServerError(CouchDBError): """The request was invalid, either because the supplied JSON was invalid, or invalid information was supplied as part of the request."""
Ancestors
- CouchDBError
- builtins.Exception
- builtins.BaseException
class MethodNotAllowedError (*args, **kwargs)
-
A request was made using an invalid HTTP request type for the URL requested. For example, you have requested a
PUT
when aPOST
is required. Errors of this type can also triggered by invalid URL strings.Expand source code
class MethodNotAllowedError(CouchDBError): """A request was made using an invalid HTTP request type for the URL requested. For example, you have requested a `PUT` when a `POST` is required. Errors of this type can also triggered by invalid URL strings."""
Ancestors
- CouchDBError
- builtins.Exception
- builtins.BaseException
class NameComplianceError (*args, **kwargs)
-
Database name does not comply with the CouchDB requirements. For more information please refer to the official documentation.
Expand source code
class NameComplianceError(CouchDBError): """Database name does not comply with the CouchDB requirements. For more information please refer to [the official documentation](https://docs.couchdb.org/en/main/api/database/common.html#put--db)."""
Ancestors
- CouchDBError
- builtins.Exception
- builtins.BaseException
class NotAcceptableError (*args, **kwargs)
-
The requested content type is not supported by the server.
Expand source code
class NotAcceptableError(CouchDBError): """The requested content type is not supported by the server."""
Ancestors
- CouchDBError
- builtins.Exception
- builtins.BaseException
class NotFoundError (*args, **kwargs)
-
The requested content could not be found. The content will include further information, as a JSON object, if available. The structure will contain two keys,
error
andreason
. For example:{"error":"not_found","reason":"no_db_file"}
Expand source code
class NotFoundError(CouchDBError): """The requested content could not be found. The content will include further information, as a JSON object, if available. The structure will contain two keys, `error` and `reason`. For example: ``` {"error":"not_found","reason":"no_db_file"} ``` """
Ancestors
- CouchDBError
- builtins.Exception
- builtins.BaseException
class PreconditionFailedError (*args, **kwargs)
-
The request headers from the client and the capabilities of the server do not match.
Expand source code
class PreconditionFailedError(CouchDBError): """The request headers from the client and the capabilities of the server do not match."""
Ancestors
- CouchDBError
- builtins.Exception
- builtins.BaseException
class ProxySchemeComplianceError (*args, **kwargs)
-
Proxy scheme does not comply with the CouchDB requirements. For more information please refer to the official documentation
Expand source code
class ProxySchemeComplianceError(CouchDBError): """Proxy scheme does not comply with the CouchDB requirements. For more information please refer to [the official documentation](https://docs.couchdb.org/en/main/api/server/common.html#replicate)"""
Ancestors
- CouchDBError
- builtins.Exception
- builtins.BaseException
class RequestEntityTooLargeError (*args, **kwargs)
-
A document exceeds the configured
couchdb3/max_document_size
value or the entire request exceeds thechttpd/max_http_request_size
valueExpand source code
class RequestEntityTooLargeError(CouchDBError): """A document exceeds the configured `couchdb3/max_document_size` value or the entire request exceeds the `chttpd/max_http_request_size` value"""
Ancestors
- CouchDBError
- builtins.Exception
- builtins.BaseException
class RequestRangeNotSatisfiableError (*args, **kwargs)
-
The range specified in the request header cannot be satisfied by the server.
Expand source code
class RequestRangeNotSatisfiableError(CouchDBError): """The range specified in the request header cannot be satisfied by the server."""
Ancestors
- CouchDBError
- builtins.Exception
- builtins.BaseException
-
The item requested was not available using the supplied authorization, or authorization was not supplied.
Expand source code
class UnauthorizedError(CouchDBError): """The item requested was not available using the supplied authorization, or authorization was not supplied."""
Ancestors
- CouchDBError
- builtins.Exception
- builtins.BaseException
class UnsupportedMediaTypeError (*args, **kwargs)
-
Content type error.
Expand source code
class UnsupportedMediaTypeError(CouchDBError): """Content type error."""
Ancestors
- CouchDBError
- builtins.Exception
- builtins.BaseException
class UserIDComplianceError (*args, **kwargs)
-
User ID does not comply with the CouchDB requirements. For more information please refer to the official documentation
Expand source code
class UserIDComplianceError(CouchDBError): """User ID does not comply with the CouchDB requirements. For more information please refer to [the official documentation](https://docs.couchdb.org/en/main/intro/security.html#org-couchdb-user)"""
Ancestors
- CouchDBError
- builtins.Exception
- builtins.BaseException