Source code for gerrit.utils.exceptions

"""Module for custom exceptions.

Where possible we try to throw exceptions with non-generic,
meaningful names.
"""


[docs] class GerritAPIException(Exception): """ Base class for all errors """
[docs] class ClientError(GerritAPIException): """ Client Error """
[docs] class ServerError(GerritAPIException): """ Server Error """
[docs] class UnauthorizedError(GerritAPIException): """ 401 Unauthorized """
[docs] class AuthError(GerritAPIException): """ 403 Forbidden is returned if the operation is not allowed because the calling user does not have sufficient permissions. """
[docs] class ValidationError(GerritAPIException): """ 400 Bad Request is returned if the request is not understood by the server due to malformed syntax. E.g. 400 Bad Request is returned if JSON input is expected but the 'Content-Type' of the request is not 'application/json' or the request body doesn't contain valid JSON. 400 Bad Request is also returned if required input fields are not set or if options are set which cannot be used together. """
[docs] class NotAllowedError(GerritAPIException): """ 405 Method Not Allowed is returned if the resource exists but doesn't support the operation. """
[docs] class ConflictError(GerritAPIException): """ 409 Conflict is returned if the request cannot be completed because the current state of the resource doesn't allow the operation. """
[docs] class NotFoundError(GerritAPIException): """ Resource cannot be found """
[docs] class UnknownBranch(KeyError, NotFoundError): """ Gerrit does not recognize the branch requested. """
[docs] class UnknownTag(KeyError, NotFoundError): """ Gerrit does not recognize the tag requested. """
[docs] class UnknownFile(KeyError, NotFoundError): """ Gerrit does not recognize the revision file requested. """
[docs] class FileContentNotFoundError(GerritAPIException): """ File content not found """
[docs] class ProjectNotFoundError(GerritAPIException): """ Project cannot be found """
[docs] class ProjectAlreadyExistsError(GerritAPIException): """ Project already exists """
[docs] class BranchNotFoundError(GerritAPIException): """ Branch cannot be found """
[docs] class BranchAlreadyExistsError(GerritAPIException): """ Branch already exists """
[docs] class TagNotFoundError(GerritAPIException): """ Tag cannot be found """
[docs] class TagAlreadyExistsError(GerritAPIException): """ Tag already exists """
[docs] class CommitNotFoundError(GerritAPIException): """ Commit cannot be found """
[docs] class GroupNotFoundError(GerritAPIException): """ Group cannot be found """
[docs] class GroupAlreadyExistsError(GerritAPIException): """ Group already exists """
[docs] class GroupMemberNotFoundError(GerritAPIException): """ Group member cannot be found """
[docs] class GroupMemberAlreadyExistsError(GerritAPIException): """ Group member already exists """
[docs] class ChangeNotFoundError(GerritAPIException): """ Change cannot be found """
[docs] class ReviewerNotFoundError(GerritAPIException): """ Reviewer cannot be found """
[docs] class ReviewerAlreadyExistsError(GerritAPIException): """ Reviewer already exists """
[docs] class AccountNotFoundError(GerritAPIException): """ Account cannot be found """
[docs] class AccountAlreadyExistsError(GerritAPIException): """ Account already exists """
[docs] class AccountEmailNotFoundError(GerritAPIException): """ Account Email cannot be found """
[docs] class AccountEmailAlreadyExistsError(GerritAPIException): """ Account Email already exists """
[docs] class SSHKeyNotFoundError(GerritAPIException): """ SSH key cannot be found """
[docs] class GPGKeyNotFoundError(GerritAPIException): """ GPG key cannot be found """
[docs] class ChangeEditNotFoundError(GerritAPIException): """ Change edit cannot be found """