blob: ff948f9cbc9f51471917516ba4a9ac89326628a8 [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 """
Dan Sandler53e902a2014-03-09 13:20:02 -040027 def __init__(self, path, reason):
28 super(NoManifestException, self).__init__()
29 self.path = path
30 self.reason = reason
31
32 def __str__(self):
33 return self.reason
Conley Owens75ee0572012-11-15 17:33:11 -080034
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070035class EditorError(Exception):
36 """Unspecified error from the user's text editor.
37 """
Shawn O. Pearce54fccd72009-06-24 07:09:51 -070038 def __init__(self, reason):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090039 super(EditorError, self).__init__()
Shawn O. Pearce54fccd72009-06-24 07:09:51 -070040 self.reason = reason
41
42 def __str__(self):
43 return self.reason
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070044
45class GitError(Exception):
46 """Unspecified internal error from git.
47 """
48 def __init__(self, command):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090049 super(GitError, self).__init__()
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070050 self.command = command
51
52 def __str__(self):
53 return self.command
54
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070055class UploadError(Exception):
56 """A bundle upload to Gerrit did not succeed.
57 """
58 def __init__(self, reason):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090059 super(UploadError, self).__init__()
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070060 self.reason = reason
61
62 def __str__(self):
63 return self.reason
64
Shawn O. Pearcef322b9a2011-09-19 14:50:58 -070065class DownloadError(Exception):
66 """Cannot download a repository.
67 """
68 def __init__(self, reason):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090069 super(DownloadError, self).__init__()
Shawn O. Pearcef322b9a2011-09-19 14:50:58 -070070 self.reason = reason
71
72 def __str__(self):
73 return self.reason
74
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070075class NoSuchProjectError(Exception):
76 """A specified project does not exist in the work tree.
77 """
78 def __init__(self, name=None):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090079 super(NoSuchProjectError, self).__init__()
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070080 self.name = name
81
82 def __str__(self):
83 if self.Name is None:
84 return 'in current directory'
85 return self.name
86
Colin Cross5acde752012-03-28 20:15:45 -070087
88class InvalidProjectGroupsError(Exception):
89 """A specified project is not suitable for the specified groups
90 """
91 def __init__(self, name=None):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090092 super(InvalidProjectGroupsError, self).__init__()
Colin Cross5acde752012-03-28 20:15:45 -070093 self.name = name
94
95 def __str__(self):
96 if self.Name is None:
97 return 'in current directory'
98 return self.name
99
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -0700100class RepoChangedException(Exception):
101 """Thrown if 'repo sync' results in repo updating its internal
102 repo or manifest repositories. In this special case we must
103 use exec to re-execute repo with the new code and manifest.
104 """
David Pursehouse8a68ff92012-09-24 12:15:13 +0900105 def __init__(self, extra_args=None):
David Pursehouse5c6eeac2012-10-11 16:44:48 +0900106 super(RepoChangedException, self).__init__()
David Pursehouse8a68ff92012-09-24 12:15:13 +0900107 self.extra_args = extra_args or []
Doug Anderson37282b42011-03-04 11:54:18 -0800108
109class HookError(Exception):
110 """Thrown if a 'repo-hook' could not be run.
111
112 The common case is that the file wasn't present when we tried to run it.
113 """