bisect-kit: refactor bisect exception classes
Restruct exceptions and move them to bisect_kit.errors.
- Distinguish VerifyOldFailed and VerifyNewFailed because they are
slightly different and callers may handle them differently.
- ExecutionFatalError is dedicated to errors of switch and eval
BUG=None
TEST=unittest
Change-Id: I6c3a1c941659846affd3b1b903932b2b61676ab2
Reviewed-on: https://chromium-review.googlesource.com/1328392
Commit-Ready: Kuang-che Wu <kcwu@chromium.org>
Tested-by: Kuang-che Wu <kcwu@chromium.org>
Reviewed-by: Kuang-che Wu <kcwu@chromium.org>
diff --git a/bisect_git.py b/bisect_git.py
index 7be641d..4846dc8 100755
--- a/bisect_git.py
+++ b/bisect_git.py
@@ -16,6 +16,7 @@
from bisect_kit import cli
from bisect_kit import core
+from bisect_kit import errors
from bisect_kit import git_util
@@ -34,9 +35,12 @@
@staticmethod
def init(opts):
- for rev in (opts.old, opts.new):
- if not git_util.is_containing_commit(opts.git_repo, rev):
- raise ValueError('rev=%s is not in git_repo=%r' % (rev, opts.git_repo))
+ if not git_util.is_containing_commit(opts.git_repo, opts.old):
+ raise errors.ArgumentError(
+ '--old', '%s is not in git_repo=%r' % (opts.old, opts.git_repo))
+ if not git_util.is_containing_commit(opts.git_repo, opts.new):
+ raise errors.ArgumentError(
+ '--new', '%s is not in git_repo=%r' % (opts.new, opts.git_repo))
config = dict(git_repo=opts.git_repo)
revlist = git_util.get_revlist(opts.git_repo, opts.old, opts.new)