blob: 21482486bb14c4bbd7382447730d981bc41a0246 [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
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070024class EditorError(Exception):
25 """Unspecified error from the user's text editor.
26 """
Shawn O. Pearce54fccd72009-06-24 07:09:51 -070027 def __init__(self, reason):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090028 super(EditorError, self).__init__()
Shawn O. Pearce54fccd72009-06-24 07:09:51 -070029 self.reason = reason
30
31 def __str__(self):
32 return self.reason
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070033
34class GitError(Exception):
35 """Unspecified internal error from git.
36 """
37 def __init__(self, command):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090038 super(GitError, self).__init__()
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070039 self.command = command
40
41 def __str__(self):
42 return self.command
43
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070044class UploadError(Exception):
45 """A bundle upload to Gerrit did not succeed.
46 """
47 def __init__(self, reason):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090048 super(UploadError, self).__init__()
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070049 self.reason = reason
50
51 def __str__(self):
52 return self.reason
53
Shawn O. Pearcef322b9a2011-09-19 14:50:58 -070054class DownloadError(Exception):
55 """Cannot download a repository.
56 """
57 def __init__(self, reason):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090058 super(DownloadError, self).__init__()
Shawn O. Pearcef322b9a2011-09-19 14:50:58 -070059 self.reason = reason
60
61 def __str__(self):
62 return self.reason
63
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070064class NoSuchProjectError(Exception):
65 """A specified project does not exist in the work tree.
66 """
67 def __init__(self, name=None):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090068 super(NoSuchProjectError, self).__init__()
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070069 self.name = name
70
71 def __str__(self):
72 if self.Name is None:
73 return 'in current directory'
74 return self.name
75
Colin Cross5acde752012-03-28 20:15:45 -070076
77class InvalidProjectGroupsError(Exception):
78 """A specified project is not suitable for the specified groups
79 """
80 def __init__(self, name=None):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090081 super(InvalidProjectGroupsError, self).__init__()
Colin Cross5acde752012-03-28 20:15:45 -070082 self.name = name
83
84 def __str__(self):
85 if self.Name is None:
86 return 'in current directory'
87 return self.name
88
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070089class RepoChangedException(Exception):
90 """Thrown if 'repo sync' results in repo updating its internal
91 repo or manifest repositories. In this special case we must
92 use exec to re-execute repo with the new code and manifest.
93 """
David Pursehouse8a68ff92012-09-24 12:15:13 +090094 def __init__(self, extra_args=None):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090095 super(RepoChangedException, self).__init__()
David Pursehouse8a68ff92012-09-24 12:15:13 +090096 self.extra_args = extra_args or []
Doug Anderson37282b42011-03-04 11:54:18 -080097
98class HookError(Exception):
99 """Thrown if a 'repo-hook' could not be run.
100
101 The common case is that the file wasn't present when we tried to run it.
102 """