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