error.py 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 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 RepoChangedException(Exception):
  59. """Thrown if 'repo sync' results in repo updating its internal
  60. repo or manifest repositories. In this special case we must
  61. use exec to re-execute repo with the new code and manifest.
  62. """
  63. def __init__(self, extra_args=[]):
  64. self.extra_args = extra_args