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_kit/codechange.py b/bisect_kit/codechange.py
index a0b4ad0..6ff23f9 100644
--- a/bisect_kit/codechange.py
+++ b/bisect_kit/codechange.py
@@ -19,6 +19,7 @@
import shutil
from bisect_kit import cli
+from bisect_kit import errors
from bisect_kit import git_util
logger = logging.getLogger(__name__)
@@ -876,7 +877,8 @@
cache_dir = os.path.join(self.root_dir, _DIFF_CACHE_DIR)
cache_filename = os.path.join(cache_dir, '%s,%s.json' % (old, new))
if not os.path.exists(cache_filename):
- raise Exception('cached revlist not found: %s' % cache_filename)
+ raise errors.InternalError(
+ 'cached revlist not found: %s' % cache_filename)
result = []
for data in json.load(file(cache_filename)):