blob: f22a0e7502f039b5f88d5fcde168b16b4e35cc55 [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
Mike Frysinger04122b72019-07-31 23:32:58 -040025class ManifestInvalidPathError(Exception):
26 """A path used in <copyfile> or <linkfile> is incorrect.
27 """
28
Conley Owens75ee0572012-11-15 17:33:11 -080029class NoManifestException(Exception):
30 """The required manifest does not exist.
31 """
Dan Sandler53e902a2014-03-09 13:20:02 -040032 def __init__(self, path, reason):
33 super(NoManifestException, self).__init__()
34 self.path = path
35 self.reason = reason
36
37 def __str__(self):
38 return self.reason
Conley Owens75ee0572012-11-15 17:33:11 -080039
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070040class EditorError(Exception):
41 """Unspecified error from the user's text editor.
42 """
Shawn O. Pearce54fccd72009-06-24 07:09:51 -070043 def __init__(self, reason):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090044 super(EditorError, self).__init__()
Shawn O. Pearce54fccd72009-06-24 07:09:51 -070045 self.reason = reason
46
47 def __str__(self):
48 return self.reason
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070049
50class GitError(Exception):
51 """Unspecified internal error from git.
52 """
53 def __init__(self, command):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090054 super(GitError, self).__init__()
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070055 self.command = command
56
57 def __str__(self):
58 return self.command
59
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070060class UploadError(Exception):
61 """A bundle upload to Gerrit did not succeed.
62 """
63 def __init__(self, reason):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090064 super(UploadError, self).__init__()
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070065 self.reason = reason
66
67 def __str__(self):
68 return self.reason
69
Shawn O. Pearcef322b9a2011-09-19 14:50:58 -070070class DownloadError(Exception):
71 """Cannot download a repository.
72 """
73 def __init__(self, reason):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090074 super(DownloadError, self).__init__()
Shawn O. Pearcef322b9a2011-09-19 14:50:58 -070075 self.reason = reason
76
77 def __str__(self):
78 return self.reason
79
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070080class NoSuchProjectError(Exception):
81 """A specified project does not exist in the work tree.
82 """
83 def __init__(self, name=None):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090084 super(NoSuchProjectError, self).__init__()
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070085 self.name = name
86
87 def __str__(self):
Anthony Kingbe4456c2015-06-03 16:59:18 +010088 if self.name is None:
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070089 return 'in current directory'
90 return self.name
91
Colin Cross5acde752012-03-28 20:15:45 -070092
93class InvalidProjectGroupsError(Exception):
94 """A specified project is not suitable for the specified groups
95 """
96 def __init__(self, name=None):
David Pursehouse5c6eeac2012-10-11 16:44:48 +090097 super(InvalidProjectGroupsError, self).__init__()
Colin Cross5acde752012-03-28 20:15:45 -070098 self.name = name
99
100 def __str__(self):
Anthony Kingbe4456c2015-06-03 16:59:18 +0100101 if self.name is None:
Colin Cross5acde752012-03-28 20:15:45 -0700102 return 'in current directory'
103 return self.name
104
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -0700105class RepoChangedException(Exception):
106 """Thrown if 'repo sync' results in repo updating its internal
107 repo or manifest repositories. In this special case we must
108 use exec to re-execute repo with the new code and manifest.
109 """
David Pursehouse8a68ff92012-09-24 12:15:13 +0900110 def __init__(self, extra_args=None):
David Pursehouse5c6eeac2012-10-11 16:44:48 +0900111 super(RepoChangedException, self).__init__()
David Pursehouse8a68ff92012-09-24 12:15:13 +0900112 self.extra_args = extra_args or []
Doug Anderson37282b42011-03-04 11:54:18 -0800113
114class HookError(Exception):
115 """Thrown if a 'repo-hook' could not be run.
116
117 The common case is that the file wasn't present when we tried to run it.
118 """