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