error.py 2.9 KB

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