diff --git a/cherry_picker/cherry_picker.py b/cherry_picker/cherry_picker.py index 3f234ec..c3c6e60 100755 --- a/cherry_picker/cherry_picker.py +++ b/cherry_picker/cherry_picker.py @@ -640,8 +640,9 @@ def check_repo(self): """ try: validate_sha(self.config["check_sha"]) - except ValueError: - raise InvalidRepoException() + self.get_state_and_verify() + except ValueError as ve: + raise InvalidRepoException(ve.args[0]) def get_state_and_verify(self): """Return the run progress state stored in the Git config. diff --git a/cherry_picker/test_cherry_picker.py b/cherry_picker/test_cherry_picker.py index 0cdd96b..d99ea81 100644 --- a/cherry_picker/test_cherry_picker.py +++ b/cherry_picker/test_cherry_picker.py @@ -862,7 +862,7 @@ class tested_state: ) with mock.patch( "cherry_picker.cherry_picker.validate_sha", return_value=True - ), pytest.raises(ValueError, match=expected_msg_regexp): + ), pytest.raises(InvalidRepoException, match=expected_msg_regexp): cherry_picker = CherryPicker("origin", "xxx", [])