error.py 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 UploadError(Exception):
  36. """A bundle upload to Gerrit did not succeed.
  37. """
  38. def __init__(self, reason):
  39. self.reason = reason
  40. def __str__(self):
  41. return self.reason
  42. class DownloadError(Exception):
  43. """Cannot download a repository.
  44. """
  45. def __init__(self, reason):
  46. self.reason = reason
  47. def __str__(self):
  48. return self.reason
  49. class NoSuchProjectError(Exception):
  50. """A specified project does not exist in the work tree.
  51. """
  52. def __init__(self, name=None):
  53. self.name = name
  54. def __str__(self):
  55. if self.Name is None:
  56. return 'in current directory'
  57. return self.name
  58. class InvalidProjectGroupsError(Exception):
  59. """A specified project is not suitable for the specified groups
  60. """
  61. def __init__(self, name=None):
  62. self.name = name
  63. def __str__(self):
  64. if self.Name is None:
  65. return 'in current directory'
  66. return self.name
  67. class RepoChangedException(Exception):
  68. """Thrown if 'repo sync' results in repo updating its internal
  69. repo or manifest repositories. In this special case we must
  70. use exec to re-execute repo with the new code and manifest.
  71. """
  72. def __init__(self, extra_args=None):
  73. self.extra_args = extra_args or []
  74. class HookError(Exception):
  75. """Thrown if a 'repo-hook' could not be run.
  76. The common case is that the file wasn't present when we tried to run it.
  77. """
  78. pass