error.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. class GitError(Exception):
  25. """Unspecified internal error from git.
  26. """
  27. def __init__(self, command):
  28. self.command = command
  29. def __str__(self):
  30. return self.command
  31. class ImportError(Exception):
  32. """An import from a non-Git format cannot be performed.
  33. """
  34. def __init__(self, reason):
  35. self.reason = reason
  36. def __str__(self):
  37. return self.reason
  38. class UploadError(Exception):
  39. """A bundle upload to Gerrit did not succeed.
  40. """
  41. def __init__(self, reason):
  42. self.reason = reason
  43. def __str__(self):
  44. return self.reason
  45. class NoSuchProjectError(Exception):
  46. """A specified project does not exist in the work tree.
  47. """
  48. def __init__(self, name=None):
  49. self.name = name
  50. def __str__(self):
  51. if self.Name is None:
  52. return 'in current directory'
  53. return self.name
  54. class RepoChangedException(Exception):
  55. """Thrown if 'repo sync' results in repo updating its internal
  56. repo or manifest repositories. In this special case we must
  57. use exec to re-execute repo with the new code and manifest.
  58. """
  59. def __init__(self, extra_args=[]):
  60. self.extra_args = extra_args