error.py 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. # Copyright (C) 2008 The Android Open Source Project
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # URL to file bug reports for repo tool issues.
  15. BUG_REPORT_URL = 'https://bugs.chromium.org/p/gerrit/issues/entry?template=Repo+tool+issue'
  16. class ManifestParseError(Exception):
  17. """Failed to parse the manifest file.
  18. """
  19. class ManifestInvalidRevisionError(Exception):
  20. """The revision value in a project is incorrect.
  21. """
  22. class ManifestInvalidPathError(Exception):
  23. """A path used in <copyfile> or <linkfile> is incorrect.
  24. """
  25. class NoManifestException(Exception):
  26. """The required manifest does not exist.
  27. """
  28. def __init__(self, path, reason):
  29. super(NoManifestException, self).__init__()
  30. self.path = path
  31. self.reason = reason
  32. def __str__(self):
  33. return self.reason
  34. class EditorError(Exception):
  35. """Unspecified error from the user's text editor.
  36. """
  37. def __init__(self, reason):
  38. super(EditorError, self).__init__()
  39. self.reason = reason
  40. def __str__(self):
  41. return self.reason
  42. class GitError(Exception):
  43. """Unspecified internal error from git.
  44. """
  45. def __init__(self, command):
  46. super(GitError, self).__init__()
  47. self.command = command
  48. def __str__(self):
  49. return self.command
  50. class UploadError(Exception):
  51. """A bundle upload to Gerrit did not succeed.
  52. """
  53. def __init__(self, reason):
  54. super(UploadError, self).__init__()
  55. self.reason = reason
  56. def __str__(self):
  57. return self.reason
  58. class DownloadError(Exception):
  59. """Cannot download a repository.
  60. """
  61. def __init__(self, reason):
  62. super(DownloadError, self).__init__()
  63. self.reason = reason
  64. def __str__(self):
  65. return self.reason
  66. class NoSuchProjectError(Exception):
  67. """A specified project does not exist in the work tree.
  68. """
  69. def __init__(self, name=None):
  70. super(NoSuchProjectError, self).__init__()
  71. self.name = name
  72. def __str__(self):
  73. if self.name is None:
  74. return 'in current directory'
  75. return self.name
  76. class InvalidProjectGroupsError(Exception):
  77. """A specified project is not suitable for the specified groups
  78. """
  79. def __init__(self, name=None):
  80. super(InvalidProjectGroupsError, self).__init__()
  81. self.name = name
  82. def __str__(self):
  83. if self.name is None:
  84. return 'in current directory'
  85. return self.name
  86. class RepoChangedException(Exception):
  87. """Thrown if 'repo sync' results in repo updating its internal
  88. repo or manifest repositories. In this special case we must
  89. use exec to re-execute repo with the new code and manifest.
  90. """
  91. def __init__(self, extra_args=None):
  92. super(RepoChangedException, self).__init__()
  93. self.extra_args = extra_args or []
  94. class HookError(Exception):
  95. """Thrown if a 'repo-hook' could not be run.
  96. The common case is that the file wasn't present when we tried to run it.
  97. """