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