diff options
Diffstat (limited to 'error.py')
-rw-r--r-- | error.py | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -14,21 +14,26 @@ | |||
14 | # See the License for the specific language governing permissions and | 14 | # See the License for the specific language governing permissions and |
15 | # limitations under the License. | 15 | # limitations under the License. |
16 | 16 | ||
17 | |||
17 | class ManifestParseError(Exception): | 18 | class ManifestParseError(Exception): |
18 | """Failed to parse the manifest file. | 19 | """Failed to parse the manifest file. |
19 | """ | 20 | """ |
20 | 21 | ||
22 | |||
21 | class ManifestInvalidRevisionError(Exception): | 23 | class ManifestInvalidRevisionError(Exception): |
22 | """The revision value in a project is incorrect. | 24 | """The revision value in a project is incorrect. |
23 | """ | 25 | """ |
24 | 26 | ||
27 | |||
25 | class ManifestInvalidPathError(Exception): | 28 | class ManifestInvalidPathError(Exception): |
26 | """A path used in <copyfile> or <linkfile> is incorrect. | 29 | """A path used in <copyfile> or <linkfile> is incorrect. |
27 | """ | 30 | """ |
28 | 31 | ||
32 | |||
29 | class NoManifestException(Exception): | 33 | class NoManifestException(Exception): |
30 | """The required manifest does not exist. | 34 | """The required manifest does not exist. |
31 | """ | 35 | """ |
36 | |||
32 | def __init__(self, path, reason): | 37 | def __init__(self, path, reason): |
33 | super(NoManifestException, self).__init__() | 38 | super(NoManifestException, self).__init__() |
34 | self.path = path | 39 | self.path = path |
@@ -37,9 +42,11 @@ class NoManifestException(Exception): | |||
37 | def __str__(self): | 42 | def __str__(self): |
38 | return self.reason | 43 | return self.reason |
39 | 44 | ||
45 | |||
40 | class EditorError(Exception): | 46 | class EditorError(Exception): |
41 | """Unspecified error from the user's text editor. | 47 | """Unspecified error from the user's text editor. |
42 | """ | 48 | """ |
49 | |||
43 | def __init__(self, reason): | 50 | def __init__(self, reason): |
44 | super(EditorError, self).__init__() | 51 | super(EditorError, self).__init__() |
45 | self.reason = reason | 52 | self.reason = reason |
@@ -47,9 +54,11 @@ class EditorError(Exception): | |||
47 | def __str__(self): | 54 | def __str__(self): |
48 | return self.reason | 55 | return self.reason |
49 | 56 | ||
57 | |||
50 | class GitError(Exception): | 58 | class GitError(Exception): |
51 | """Unspecified internal error from git. | 59 | """Unspecified internal error from git. |
52 | """ | 60 | """ |
61 | |||
53 | def __init__(self, command): | 62 | def __init__(self, command): |
54 | super(GitError, self).__init__() | 63 | super(GitError, self).__init__() |
55 | self.command = command | 64 | self.command = command |
@@ -57,9 +66,11 @@ class GitError(Exception): | |||
57 | def __str__(self): | 66 | def __str__(self): |
58 | return self.command | 67 | return self.command |
59 | 68 | ||
69 | |||
60 | class UploadError(Exception): | 70 | class UploadError(Exception): |
61 | """A bundle upload to Gerrit did not succeed. | 71 | """A bundle upload to Gerrit did not succeed. |
62 | """ | 72 | """ |
73 | |||
63 | def __init__(self, reason): | 74 | def __init__(self, reason): |
64 | super(UploadError, self).__init__() | 75 | super(UploadError, self).__init__() |
65 | self.reason = reason | 76 | self.reason = reason |
@@ -67,9 +78,11 @@ class UploadError(Exception): | |||
67 | def __str__(self): | 78 | def __str__(self): |
68 | return self.reason | 79 | return self.reason |
69 | 80 | ||
81 | |||
70 | class DownloadError(Exception): | 82 | class DownloadError(Exception): |
71 | """Cannot download a repository. | 83 | """Cannot download a repository. |
72 | """ | 84 | """ |
85 | |||
73 | def __init__(self, reason): | 86 | def __init__(self, reason): |
74 | super(DownloadError, self).__init__() | 87 | super(DownloadError, self).__init__() |
75 | self.reason = reason | 88 | self.reason = reason |
@@ -77,9 +90,11 @@ class DownloadError(Exception): | |||
77 | def __str__(self): | 90 | def __str__(self): |
78 | return self.reason | 91 | return self.reason |
79 | 92 | ||
93 | |||
80 | class NoSuchProjectError(Exception): | 94 | class NoSuchProjectError(Exception): |
81 | """A specified project does not exist in the work tree. | 95 | """A specified project does not exist in the work tree. |
82 | """ | 96 | """ |
97 | |||
83 | def __init__(self, name=None): | 98 | def __init__(self, name=None): |
84 | super(NoSuchProjectError, self).__init__() | 99 | super(NoSuchProjectError, self).__init__() |
85 | self.name = name | 100 | self.name = name |
@@ -93,6 +108,7 @@ class NoSuchProjectError(Exception): | |||
93 | class InvalidProjectGroupsError(Exception): | 108 | class InvalidProjectGroupsError(Exception): |
94 | """A specified project is not suitable for the specified groups | 109 | """A specified project is not suitable for the specified groups |
95 | """ | 110 | """ |
111 | |||
96 | def __init__(self, name=None): | 112 | def __init__(self, name=None): |
97 | super(InvalidProjectGroupsError, self).__init__() | 113 | super(InvalidProjectGroupsError, self).__init__() |
98 | self.name = name | 114 | self.name = name |
@@ -102,15 +118,18 @@ class InvalidProjectGroupsError(Exception): | |||
102 | return 'in current directory' | 118 | return 'in current directory' |
103 | return self.name | 119 | return self.name |
104 | 120 | ||
121 | |||
105 | class RepoChangedException(Exception): | 122 | class RepoChangedException(Exception): |
106 | """Thrown if 'repo sync' results in repo updating its internal | 123 | """Thrown if 'repo sync' results in repo updating its internal |
107 | repo or manifest repositories. In this special case we must | 124 | repo or manifest repositories. In this special case we must |
108 | use exec to re-execute repo with the new code and manifest. | 125 | use exec to re-execute repo with the new code and manifest. |
109 | """ | 126 | """ |
127 | |||
110 | def __init__(self, extra_args=None): | 128 | def __init__(self, extra_args=None): |
111 | super(RepoChangedException, self).__init__() | 129 | super(RepoChangedException, self).__init__() |
112 | self.extra_args = extra_args or [] | 130 | self.extra_args = extra_args or [] |
113 | 131 | ||
132 | |||
114 | class HookError(Exception): | 133 | class HookError(Exception): |
115 | """Thrown if a 'repo-hook' could not be run. | 134 | """Thrown if a 'repo-hook' could not be run. |
116 | 135 | ||