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