blob: 25ff80d10c151d36955a3836ac8c71134ff2f7c6 [file] [log] [blame]
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -07001# Copyright (C) 2008 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
David Pursehouse819827a2020-02-12 15:20:19 +090015
Raman Tenneti6a872c92021-01-14 19:17:50 -080016# URL to file bug reports for repo tool issues.
17BUG_REPORT_URL = 'https://bugs.chromium.org/p/gerrit/issues/entry?template=Repo+tool+issue'
18
19
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070020class ManifestParseError(Exception):
21 """Failed to parse the manifest file.
22 """
23
David Pursehouse819827a2020-02-12 15:20:19 +090024
Mike Frysinger54133972021-03-01 21:38:08 -050025class ManifestInvalidRevisionError(ManifestParseError):
Shawn O. Pearce559b8462009-03-02 12:56:08 -080026 """The revision value in a project is incorrect.
27 """
28
David Pursehouse819827a2020-02-12 15:20:19 +090029
Mike Frysinger54133972021-03-01 21:38:08 -050030class ManifestInvalidPathError(ManifestParseError):
Mike Frysinger04122b72019-07-31 23:32:58 -040031 """A path used in or is incorrect.
32 """
33
David Pursehouse819827a2020-02-12 15:20:19 +090034
Conley Owens75ee0572012-11-15 17:33:11 -080035class NoManifestException(Exception):
36 """The required manifest does not exist.
37 """
David Pursehouse819827a2020-02-12 15:20:19 +090038
Dan Sandler53e902a2014-03-09 13:20:02 -040039 def __init__(self, path, reason):
Mike Frysinger5d9c4972021-02-19 13:34:09 -050040 super().__init__(path, reason)
Dan Sandler53e902a2014-03-09 13:20:02 -040041 self.path = path
42 self.reason = reason
43
44 def __str__(self):
45 return self.reason
Conley Owens75ee0572012-11-15 17:33:11 -080046
David Pursehouse819827a2020-02-12 15:20:19 +090047
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070048class EditorError(Exception):
49 """Unspecified error from the user's text editor.
50 """
David Pursehouse819827a2020-02-12 15:20:19 +090051
Shawn O. Pearce54fccd72009-06-24 07:09:51 -070052 def __init__(self, reason):
Mike Frysinger5d9c4972021-02-19 13:34:09 -050053 super().__init__(reason)
Shawn O. Pearce54fccd72009-06-24 07:09:51 -070054 self.reason = reason
55
56 def __str__(self):
57 return self.reason
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070058
David Pursehouse819827a2020-02-12 15:20:19 +090059
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070060class GitError(Exception):
61 """Unspecified internal error from git.
62 """
David Pursehouse819827a2020-02-12 15:20:19 +090063
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070064 def __init__(self, command):
Mike Frysinger5d9c4972021-02-19 13:34:09 -050065 super().__init__(command)
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070066 self.command = command
67
68 def __str__(self):
69 return self.command
70
David Pursehouse819827a2020-02-12 15:20:19 +090071
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070072class UploadError(Exception):
73 """A bundle upload to Gerrit did not succeed.
74 """
David Pursehouse819827a2020-02-12 15:20:19 +090075
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070076 def __init__(self, reason):
Mike Frysinger5d9c4972021-02-19 13:34:09 -050077 super().__init__(reason)
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070078 self.reason = reason
79
80 def __str__(self):
81 return self.reason
82
David Pursehouse819827a2020-02-12 15:20:19 +090083
Shawn O. Pearcef322b9a2011-09-19 14:50:58 -070084class DownloadError(Exception):
85 """Cannot download a repository.
86 """
David Pursehouse819827a2020-02-12 15:20:19 +090087
Shawn O. Pearcef322b9a2011-09-19 14:50:58 -070088 def __init__(self, reason):
Mike Frysinger5d9c4972021-02-19 13:34:09 -050089 super().__init__(reason)
Shawn O. Pearcef322b9a2011-09-19 14:50:58 -070090 self.reason = reason
91
92 def __str__(self):
93 return self.reason
94
David Pursehouse819827a2020-02-12 15:20:19 +090095
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070096class NoSuchProjectError(Exception):
97 """A specified project does not exist in the work tree.
98 """
David Pursehouse819827a2020-02-12 15:20:19 +090099
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -0700100 def __init__(self, name=None):
Mike Frysinger5d9c4972021-02-19 13:34:09 -0500101 super().__init__(name)
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -0700102 self.name = name
103
104 def __str__(self):
Anthony Kingbe4456c2015-06-03 16:59:18 +0100105 if self.name is None:
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -0700106 return 'in current directory'
107 return self.name
108
Colin Cross5acde752012-03-28 20:15:45 -0700109
110class InvalidProjectGroupsError(Exception):
111 """A specified project is not suitable for the specified groups
112 """
David Pursehouse819827a2020-02-12 15:20:19 +0900113
Colin Cross5acde752012-03-28 20:15:45 -0700114 def __init__(self, name=None):
Mike Frysinger5d9c4972021-02-19 13:34:09 -0500115 super().__init__(name)
Colin Cross5acde752012-03-28 20:15:45 -0700116 self.name = name
117
118 def __str__(self):
Anthony Kingbe4456c2015-06-03 16:59:18 +0100119 if self.name is None:
Colin Cross5acde752012-03-28 20:15:45 -0700120 return 'in current directory'
121 return self.name
122
David Pursehouse819827a2020-02-12 15:20:19 +0900123
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -0700124class RepoChangedException(Exception):
125 """Thrown if 'repo sync' results in repo updating its internal
126 repo or manifest repositories. In this special case we must
127 use exec to re-execute repo with the new code and manifest.
128 """
David Pursehouse819827a2020-02-12 15:20:19 +0900129
David Pursehouse8a68ff92012-09-24 12:15:13 +0900130 def __init__(self, extra_args=None):
Mike Frysinger5d9c4972021-02-19 13:34:09 -0500131 super().__init__(extra_args)
David Pursehouse8a68ff92012-09-24 12:15:13 +0900132 self.extra_args = extra_args or []
Doug Anderson37282b42011-03-04 11:54:18 -0800133
David Pursehouse819827a2020-02-12 15:20:19 +0900134
Doug Anderson37282b42011-03-04 11:54:18 -0800135class HookError(Exception):
136 """Thrown if a 'repo-hook' could not be run.
137
138 The common case is that the file wasn't present when we tried to run it.
139 """