exceptions.py 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. class APGitException(Exception):
  2. pass
  3. class NonGitDirectoryError(APGitException):
  4. def __init__(self, directory: str):
  5. message = f"The directory '{directory}' is not a Git directory."
  6. super().__init__(message)
  7. class CommitNotFoundError(APGitException):
  8. def __init__(self, commit_ref: str):
  9. message = f"The commit with ref/id '{commit_ref}' not found in tree."
  10. super().__init__(message)
  11. class RemoteNotFoundError(APGitException):
  12. def __init__(self, remote: str):
  13. message = f"The remote named '{remote}' is not added."
  14. super().__init__(message)
  15. class DuplicateRemoteError(APGitException):
  16. def __init__(self, remote: str):
  17. message = f"The remote named '{remote}' already exists."
  18. super().__init__(message)
  19. class LockNotInitializedError(APGitException):
  20. def __init__(self, lock_name: str, path: str):
  21. message = f"The '{lock_name}' Lock for the git repository"
  22. f" at '{path}' is not initialized."
  23. super().__init__(message)