blob: 5bfe3a6662b96a68210c51935cf416bc24e8f135 [file] [log] [blame]
Mike Frysingerf6013762019-06-13 02:30:51 -04001# -*- coding:utf-8 -*-
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -07002#
3# Copyright (C) 2008 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17class ManifestParseError(Exception):
18 """Failed to parse the manifest file.
19 """
20
Shawn O. Pearce559b8462009-03-02 12:56:08 -080021class ManifestInvalidRevisionError(Exception):
22 """The revision value in a project is incorrect.
23 """
24
Conley Owens75ee0572012-11-15 17:33:11 -080025class NoManifestException(Exception):
26 """The required manifest does not exist.
27 """
Dan Sandler53e902a2014-03-09 13:20:02 -040028 def __init__(self, path, reason):
29 super(NoManifestException, self).__init__()
30 self.path = path
31 self.reason = reason
32
33 def __str__(self):
34 return self.reason
Conley Owens75ee0572012-11-15 17:33:11 -080035
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070036class EditorError(Exception):
37 """Unspecified error from the user's text editor.
38 """
Shawn O. Pearce54fccd72009-06-24 07:09:51 -070039 def __init__(self, reason):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090040 super(EditorError, self).__init__()
Shawn O. Pearce54fccd72009-06-24 07:09:51 -070041 self.reason = reason
42
43 def __str__(self):
44 return self.reason
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070045
46class GitError(Exception):
47 """Unspecified internal error from git.
48 """
49 def __init__(self, command):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090050 super(GitError, self).__init__()
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070051 self.command = command
52
53 def __str__(self):
54 return self.command
55
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070056class UploadError(Exception):
57 """A bundle upload to Gerrit did not succeed.
58 """
59 def __init__(self, reason):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090060 super(UploadError, self).__init__()
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070061 self.reason = reason
62
63 def __str__(self):
64 return self.reason
65
Shawn O. Pearcef322b9a2011-09-19 14:50:58 -070066class DownloadError(Exception):
67 """Cannot download a repository.
68 """
69 def __init__(self, reason):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090070 super(DownloadError, self).__init__()
Shawn O. Pearcef322b9a2011-09-19 14:50:58 -070071 self.reason = reason
72
73 def __str__(self):
74 return self.reason
75
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070076class NoSuchProjectError(Exception):
77 """A specified project does not exist in the work tree.
78 """
79 def __init__(self, name=None):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090080 super(NoSuchProjectError, self).__init__()
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070081 self.name = name
82
83 def __str__(self):
Anthony Kingbe4456c2015-06-03 16:59:18 +010084 if self.name is None:
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070085 return 'in current directory'
86 return self.name
87
Colin Cross5acde752012-03-28 20:15:45 -070088
89class InvalidProjectGroupsError(Exception):
90 """A specified project is not suitable for the specified groups
91 """
92 def __init__(self, name=None):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090093 super(InvalidProjectGroupsError, self).__init__()
Colin Cross5acde752012-03-28 20:15:45 -070094 self.name = name
95
96 def __str__(self):
Anthony Kingbe4456c2015-06-03 16:59:18 +010097 if self.name is None:
Colin Cross5acde752012-03-28 20:15:45 -070098 return 'in current directory'
99 return self.name
100
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -0700101class RepoChangedException(Exception):
102 """Thrown if 'repo sync' results in repo updating its internal
103 repo or manifest repositories. In this special case we must
104 use exec to re-execute repo with the new code and manifest.
105 """
David Pursehouse8a68ff92012-09-24 12:15:13 +0900106 def __init__(self, extra_args=None):
David Pursehouse5c6eeac2012-10-11 16:44:48 +0900107 super(RepoChangedException, self).__init__()
David Pursehouse8a68ff92012-09-24 12:15:13 +0900108 self.extra_args = extra_args or []
Doug Anderson37282b42011-03-04 11:54:18 -0800109
110class HookError(Exception):
111 """Thrown if a 'repo-hook' could not be run.
112
113 The common case is that the file wasn't present when we tried to run it.
114 """