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