diff --git a/error.py b/error.py index 8559d91..f8476c0 100644 --- a/error.py +++ b/error.py @@ -65,6 +65,18 @@ class PullRequestError(Exception): def __str__(self): return self.reason + +class ForkProjectError(Exception): + """ pull request to Gitee did not succeed. + """ + + def __init__(self, reason): + super(ForkProjectError, self).__init__() + self.reason = reason + + def __str__(self): + return self.reason + class GitError(Exception): """Unspecified internal error from git. """ diff --git a/project.py b/project.py index 8d9bc84..e4307f7 100644 --- a/project.py +++ b/project.py @@ -36,7 +36,7 @@ from color import Coloring from git_command import GitCommand, git_require from git_config import GitConfig, IsId, GetSchemeFromUrl, GetUrlCookieFile, \ ID_RE -from error import GitError, HookError, UploadError, DownloadError, PullRequestError +from error import GitError, HookError, UploadError, DownloadError, PullRequestError, ForkProjectError from error import ManifestInvalidRevisionError, ManifestInvalidPathError from error import NoManifestException import platform_utils @@ -1477,7 +1477,7 @@ class Project(object): if not token: token = GitConfig.ForUser().GetString('repo.token') if not token: - raise PullRequestError('repo.token is None, Please set it before pushing, you need `repo config -h`') + raise ForkProjectError('repo.token is None, Please set it before pushing, you need `repo config -h`') gitee_url = 'https://gitee.com/api/v5/repos' namespace = self._GiteeNamespace(type='upload') post_url = '/'.join([gitee_url, namespace, self.name, 'forks'])