error.py 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 EditorError(Exception):
  22. """Unspecified error from the user's text editor.
  23. """
  24. def __init__(self, reason):
  25. self.reason = reason
  26. def __str__(self):
  27. return self.reason
  28. class GitError(Exception):
  29. """Unspecified internal error from git.
  30. """
  31. def __init__(self, command):
  32. self.command = command
  33. def __str__(self):
  34. return self.command
  35. class ImportError(Exception):
  36. """An import from a non-Git format cannot be performed.
  37. """
  38. def __init__(self, reason):
  39. self.reason = reason
  40. def __str__(self):
  41. return self.reason
  42. class UploadError(Exception):
  43. """A bundle upload to Gerrit did not succeed.
  44. """
  45. def __init__(self, reason):
  46. self.reason = reason
  47. def __str__(self):
  48. return self.reason
  49. class DownloadError(Exception):
  50. """Cannot download a repository.
  51. """
  52. def __init__(self, reason):
  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. self.name = name
  61. def __str__(self):
  62. if self.Name is None:
  63. return 'in current directory'
  64. return self.name
  65. class InvalidProjectGroupsError(Exception):
  66. """A specified project is not suitable for the specified groups
  67. """
  68. def __init__(self, name=None):
  69. self.name = name
  70. def __str__(self):
  71. if self.Name is None:
  72. return 'in current directory'
  73. return self.name
  74. class RepoChangedException(Exception):
  75. """Thrown if 'repo sync' results in repo updating its internal
  76. repo or manifest repositories. In this special case we must
  77. use exec to re-execute repo with the new code and manifest.
  78. """
  79. def __init__(self, extra_args=[]):
  80. self.extra_args = extra_args
  81. class HookError(Exception):
  82. """Thrown if a 'repo-hook' could not be run.
  83. The common case is that the file wasn't present when we tried to run it.
  84. """
  85. pass