The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1 | # 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 Pursehouse | 819827a | 2020-02-12 15:20:19 +0900 | [diff] [blame] | 15 | |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 16 | class ManifestParseError(Exception): |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 17 | """Failed to parse the manifest file.""" |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 18 | |
David Pursehouse | 819827a | 2020-02-12 15:20:19 +0900 | [diff] [blame] | 19 | |
Mike Frysinger | 5413397 | 2021-03-01 21:38:08 -0500 | [diff] [blame] | 20 | class ManifestInvalidRevisionError(ManifestParseError): |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 21 | """The revision value in a project is incorrect.""" |
Shawn O. Pearce | 559b846 | 2009-03-02 12:56:08 -0800 | [diff] [blame] | 22 | |
David Pursehouse | 819827a | 2020-02-12 15:20:19 +0900 | [diff] [blame] | 23 | |
Mike Frysinger | 5413397 | 2021-03-01 21:38:08 -0500 | [diff] [blame] | 24 | class ManifestInvalidPathError(ManifestParseError): |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 25 | """A path used in <copyfile> or <linkfile> is incorrect.""" |
Mike Frysinger | 04122b7 | 2019-07-31 23:32:58 -0400 | [diff] [blame] | 26 | |
David Pursehouse | 819827a | 2020-02-12 15:20:19 +0900 | [diff] [blame] | 27 | |
Conley Owens | 75ee057 | 2012-11-15 17:33:11 -0800 | [diff] [blame] | 28 | class NoManifestException(Exception): |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 29 | """The required manifest does not exist.""" |
David Pursehouse | 819827a | 2020-02-12 15:20:19 +0900 | [diff] [blame] | 30 | |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 31 | def __init__(self, path, reason): |
| 32 | super().__init__(path, reason) |
| 33 | self.path = path |
| 34 | self.reason = reason |
Dan Sandler | 53e902a | 2014-03-09 13:20:02 -0400 | [diff] [blame] | 35 | |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 36 | def __str__(self): |
| 37 | return self.reason |
Conley Owens | 75ee057 | 2012-11-15 17:33:11 -0800 | [diff] [blame] | 38 | |
David Pursehouse | 819827a | 2020-02-12 15:20:19 +0900 | [diff] [blame] | 39 | |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 40 | class EditorError(Exception): |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 41 | """Unspecified error from the user's text editor.""" |
David Pursehouse | 819827a | 2020-02-12 15:20:19 +0900 | [diff] [blame] | 42 | |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 43 | def __init__(self, reason): |
| 44 | super().__init__(reason) |
| 45 | self.reason = reason |
Shawn O. Pearce | 54fccd7 | 2009-06-24 07:09:51 -0700 | [diff] [blame] | 46 | |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 47 | def __str__(self): |
| 48 | return self.reason |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 49 | |
David Pursehouse | 819827a | 2020-02-12 15:20:19 +0900 | [diff] [blame] | 50 | |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 51 | class GitError(Exception): |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 52 | """Unspecified internal error from git.""" |
David Pursehouse | 819827a | 2020-02-12 15:20:19 +0900 | [diff] [blame] | 53 | |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 54 | def __init__(self, command): |
| 55 | super().__init__(command) |
| 56 | self.command = command |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 57 | |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 58 | def __str__(self): |
| 59 | return self.command |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 60 | |
David Pursehouse | 819827a | 2020-02-12 15:20:19 +0900 | [diff] [blame] | 61 | |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 62 | class UploadError(Exception): |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 63 | """A bundle upload to Gerrit did not succeed.""" |
David Pursehouse | 819827a | 2020-02-12 15:20:19 +0900 | [diff] [blame] | 64 | |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 65 | def __init__(self, reason): |
| 66 | super().__init__(reason) |
| 67 | self.reason = reason |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 68 | |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 69 | def __str__(self): |
| 70 | return self.reason |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 71 | |
David Pursehouse | 819827a | 2020-02-12 15:20:19 +0900 | [diff] [blame] | 72 | |
Shawn O. Pearce | f322b9a | 2011-09-19 14:50:58 -0700 | [diff] [blame] | 73 | class DownloadError(Exception): |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 74 | """Cannot download a repository.""" |
David Pursehouse | 819827a | 2020-02-12 15:20:19 +0900 | [diff] [blame] | 75 | |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 76 | def __init__(self, reason): |
| 77 | super().__init__(reason) |
| 78 | self.reason = reason |
Shawn O. Pearce | f322b9a | 2011-09-19 14:50:58 -0700 | [diff] [blame] | 79 | |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 80 | def __str__(self): |
| 81 | return self.reason |
Shawn O. Pearce | f322b9a | 2011-09-19 14:50:58 -0700 | [diff] [blame] | 82 | |
David Pursehouse | 819827a | 2020-02-12 15:20:19 +0900 | [diff] [blame] | 83 | |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 84 | class NoSuchProjectError(Exception): |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 85 | """A specified project does not exist in the work tree.""" |
David Pursehouse | 819827a | 2020-02-12 15:20:19 +0900 | [diff] [blame] | 86 | |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 87 | def __init__(self, name=None): |
| 88 | super().__init__(name) |
| 89 | self.name = name |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 90 | |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 91 | def __str__(self): |
| 92 | if self.name is None: |
| 93 | return "in current directory" |
| 94 | return self.name |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 95 | |
Colin Cross | 5acde75 | 2012-03-28 20:15:45 -0700 | [diff] [blame] | 96 | |
| 97 | class InvalidProjectGroupsError(Exception): |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 98 | """A specified project is not suitable for the specified groups""" |
David Pursehouse | 819827a | 2020-02-12 15:20:19 +0900 | [diff] [blame] | 99 | |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 100 | def __init__(self, name=None): |
| 101 | super().__init__(name) |
| 102 | self.name = name |
Colin Cross | 5acde75 | 2012-03-28 20:15:45 -0700 | [diff] [blame] | 103 | |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 104 | def __str__(self): |
| 105 | if self.name is None: |
| 106 | return "in current directory" |
| 107 | return self.name |
Colin Cross | 5acde75 | 2012-03-28 20:15:45 -0700 | [diff] [blame] | 108 | |
David Pursehouse | 819827a | 2020-02-12 15:20:19 +0900 | [diff] [blame] | 109 | |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 110 | class RepoChangedException(Exception): |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 111 | """Thrown if 'repo sync' results in repo updating its internal |
| 112 | repo or manifest repositories. In this special case we must |
| 113 | use exec to re-execute repo with the new code and manifest. |
| 114 | """ |
David Pursehouse | 819827a | 2020-02-12 15:20:19 +0900 | [diff] [blame] | 115 | |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 116 | def __init__(self, extra_args=None): |
| 117 | super().__init__(extra_args) |
| 118 | self.extra_args = extra_args or [] |
Doug Anderson | 37282b4 | 2011-03-04 11:54:18 -0800 | [diff] [blame] | 119 | |
David Pursehouse | 819827a | 2020-02-12 15:20:19 +0900 | [diff] [blame] | 120 | |
Doug Anderson | 37282b4 | 2011-03-04 11:54:18 -0800 | [diff] [blame] | 121 | class HookError(Exception): |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 122 | """Thrown if a 'repo-hook' could not be run. |
Doug Anderson | 37282b4 | 2011-03-04 11:54:18 -0800 | [diff] [blame] | 123 | |
Gavin Mak | ea2e330 | 2023-03-11 06:46:20 +0000 | [diff] [blame^] | 124 | The common case is that the file wasn't present when we tried to run it. |
| 125 | """ |