blob: 7e52b0166238944ab3701df0c4cf70e786db816b [file] [log] [blame]
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -07001#
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
16class ManifestParseError(Exception):
17 """Failed to parse the manifest file.
18 """
19
Shawn O. Pearce559b8462009-03-02 12:56:08 -080020class ManifestInvalidRevisionError(Exception):
21 """The revision value in a project is incorrect.
22 """
23
Conley Owens75ee0572012-11-15 17:33:11 -080024class NoManifestException(Exception):
25 """The required manifest does not exist.
26 """
27
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070028class EditorError(Exception):
29 """Unspecified error from the user's text editor.
30 """
Shawn O. Pearce54fccd72009-06-24 07:09:51 -070031 def __init__(self, reason):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090032 super(EditorError, self).__init__()
Shawn O. Pearce54fccd72009-06-24 07:09:51 -070033 self.reason = reason
34
35 def __str__(self):
36 return self.reason
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070037
38class GitError(Exception):
39 """Unspecified internal error from git.
40 """
41 def __init__(self, command):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090042 super(GitError, self).__init__()
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070043 self.command = command
44
45 def __str__(self):
46 return self.command
47
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070048class UploadError(Exception):
49 """A bundle upload to Gerrit did not succeed.
50 """
51 def __init__(self, reason):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090052 super(UploadError, self).__init__()
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070053 self.reason = reason
54
55 def __str__(self):
56 return self.reason
57
Shawn O. Pearcef322b9a2011-09-19 14:50:58 -070058class DownloadError(Exception):
59 """Cannot download a repository.
60 """
61 def __init__(self, reason):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090062 super(DownloadError, self).__init__()
Shawn O. Pearcef322b9a2011-09-19 14:50:58 -070063 self.reason = reason
64
65 def __str__(self):
66 return self.reason
67
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070068class NoSuchProjectError(Exception):
69 """A specified project does not exist in the work tree.
70 """
71 def __init__(self, name=None):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090072 super(NoSuchProjectError, self).__init__()
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070073 self.name = name
74
75 def __str__(self):
76 if self.Name is None:
77 return 'in current directory'
78 return self.name
79
Colin Cross5acde752012-03-28 20:15:45 -070080
81class InvalidProjectGroupsError(Exception):
82 """A specified project is not suitable for the specified groups
83 """
84 def __init__(self, name=None):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090085 super(InvalidProjectGroupsError, self).__init__()
Colin Cross5acde752012-03-28 20:15:45 -070086 self.name = name
87
88 def __str__(self):
89 if self.Name is None:
90 return 'in current directory'
91 return self.name
92
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070093class RepoChangedException(Exception):
94 """Thrown if 'repo sync' results in repo updating its internal
95 repo or manifest repositories. In this special case we must
96 use exec to re-execute repo with the new code and manifest.
97 """
David Pursehouse8a68ff92012-09-24 12:15:13 +090098 def __init__(self, extra_args=None):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090099 super(RepoChangedException, self).__init__()
David Pursehouse8a68ff92012-09-24 12:15:13 +0900100 self.extra_args = extra_args or []
Doug Anderson37282b42011-03-04 11:54:18 -0800101
102class HookError(Exception):
103 """Thrown if a 'repo-hook' could not be run.
104
105 The common case is that the file wasn't present when we tried to run it.
106 """