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