1#!/usr/bin/env python3
2#
3# Copyright 2018 - 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"""Define errors that are raised by AIDEgen."""
17
18
19class AIDEgenError(Exception):
20    """Base AIDEgen exception."""
21
22
23class BuildFailureError(AIDEgenError):
24    """Raised when a build failed."""
25
26
27class GenerateIDEProjectFileError(AIDEgenError):
28    """Raised when IDE project files are not generated."""
29
30
31class JsonFileNotExistError(AIDEgenError):
32    """Raised when a json file does not exist."""
33
34
35class EmptyModuleDependencyError(AIDEgenError):
36    """Raised when the module dependency is empty. Note that even
37    a standalone module without jar dependency shall have its src path as
38    dependency.
39    """
40
41class ProjectOutsideAndroidRootError(AIDEgenError):
42    """Raised when a project to be generated IDE project file is not under
43    source tree's root directory."""
44
45
46class ProjectPathNotExistError(AIDEgenError):
47    """Raised when a project path does not exist."""
48
49
50class NoModuleDefinedInModuleInfoError(AIDEgenError):
51    """Raised when a module is not defined in module-info.json."""
52
53
54class IDENotExistError(AIDEgenError):
55    """Raised if no IDE exists in a specific path."""
56
57
58class FakeModuleError(AIDEgenError):
59    """Raised if the module is a fake module."""
60
61
62class InvalidXMLError(AIDEgenError):
63    """Raised if parsing xml file failed."""
64
65
66class InstanceNotExistError(AIDEgenError):
67    """Raised if instance does not exist."""
68
69
70class ModuleInfoEmptyError(AIDEgenError):
71    """Raised if module's info dictionary is empty."""
72
73
74class NoModuleNameDefinedInModuleInfoError(AIDEgenError):
75    """Raised if 'module_name' key isn't defined in module's info dictionary."""
76
77
78class NoPathDefinedInModuleInfoError(AIDEgenError):
79    """Raised if 'path' key isn't defined in module's info dictionary."""
80
81
82# The following error is used by aidegen_functional_test module.
83class CommitIDNotExistError(AIDEgenError):
84    """Raised if the commit id doesn't exist."""
85