]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
exceptions: Add BranchMismatchError
authorZack Cerza <zack@redhat.com>
Fri, 22 Apr 2022 21:34:51 +0000 (15:34 -0600)
committerZack Cerza <zack@cerza.org>
Wed, 27 Apr 2022 20:51:10 +0000 (14:51 -0600)
Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/exceptions.py

index a33cec041583b55e6a6f4dff815f63966180cc97..3939ba53c6434202b266cc7f2a26f14358c67c8d 100644 (file)
@@ -12,6 +12,18 @@ class BranchNotFoundError(ValueError):
             branch=self.branch, repo_str=repo_str)
 
 
+class BranchMismatchError(ValueError):
+    def __init__(self, branch, repo, reason=None):
+        self.branch = branch
+        self.repo = repo
+        self.reason = reason
+
+    def __str__(self):
+        msg = f"Cannot use branch {self.branch} with repo {self.repo}"
+        if self.reason:
+            msg = f"{msg} because {self.reason}"
+        return msg
+
 class CommitNotFoundError(ValueError):
     def __init__(self, commit, repo=None):
         self.commit = commit